information for each branch
git br--merged # View branches that have been merged into the current branch
git br--no-merged # View branches that have not been merged into the current branch
Git Co
Git co-b
git co-b
Git Co $id # Checkout A history commit record, but without branching information, switching to another branch will automatically delete
Git co $id-B
git br-d
git br-d
Branch Merging and RebaseC code
git merge
git merge origin/master--no-
Git local repository synchronized to remote repository$ git Remote add Origin http://github.com/powfulCsharp/NuUserControl.git$ Git push-u Origin MasterClone a remote repository to a local using git clone +urlCreate a branch in a remote repository with git branch+ branch name to move out of branch with git checkout + branch nameUsing git add filename git commit-m "" will not find changes when switching to the main version after modifying the file on the branchMerge the changes in the branch into
bug -- 013. Fix the bug, merge the bug branches, and delete the bug branches.Git merge bug -- 01Git branch-d bug -- 014. Go back to dev, view stash, delete stash, and continue to work.Checkout devGit stash listGit stash apply recoveryGit stash pop recovery and Deletion5. Fo
simple classification of GIT operations, as follows--
Remote Repository class: Git clone/remote/pull/push/rebase/fetch
Branch class (including tag): Git Branch/tag/checkout/stash
Information lookup: Git status/log/diff
Local normal operation: Git add/commit/rm/merge/reset
Here is just my personal classification, everyone has a different classification of it, welcome to add.What you need to emphasize is that you need to have
processed
Git push Origin branch name
11. Submit the Merge Request
After submitting the merge request, the code approval team colleagues will review the submitted code, and no problem will agree to merge requests and merge the code from the test branch into the master branch
Git using tips
The use of Stash
Sometimes there is a scenario where you develop a feature on a local branch and there is an urgent bug that needs to be handled,
currently pointing to has more than one *3, Switch branch is git checkout branchname4. Merge branch: git merge branchname merge branchname to current branch5. Delete branch: git branch-d branchname Delete branchname BranchNote: creating, merging, and deleting branches are very fast, git encourages the use of branching to complete a task, deleting branches after merging, and working directly on the master branch is the same effect, but the process is much more secure, because in these processes
If there are some configuration files on the system that have been configured on the server and then later developed and then added some new configuration items,
A code violation occurs when this profile is published:
Error:your local changes to the following files would is overwritten by merge:protected/config/main.phpPlease, commit your changes or stash them before you can merge.
If you want to keep the changes made on the production server, simp
When you use git pull code, you often encounter conflicts such as the following:
Error:your local changes to the following files would is overwritten by merge:Dpcm/src/struts.xmlPlease, commit your changes or stash them before you can merge.
In this case, you can use the following steps to resolve
First: Store files that are locally conflicting with the server first.
$ git stash
Second: Use the
[variable name]:[branch name]This command deletes the branch on the remote repository.Git pullUsage: git pull [Repository Link]This command extracts and merges changes from the remote server into your working directory.Git stashUsage: git stash saveThis command temporarily stores all modified trace files.Usage: git stash popThis command restores the most recently hidden files.Usage: git
/learngit.gitSecond, git common commands"Basic Command"
mkdir creating a File cd file entry
Git init turns this directory into a repository that git can manage, generating. git files
git add readme.txt Adding files to the repository
Git commit-m "whrote a Readme file" submitted to the warehouse
Git status check the current state of the repository, tell Readme.txt to modify it, but not ready to commit
Git diff readme.txt display changes similar to Linux diff command
Git log shows
: master. You can view the status of the version library.$ Git status
2. add files to version library management (add)$ Git add. # add all files$ Git add filename # add a specified fileYou can also use git add to modify files.
3. Submit changes (commit)Use the commit command to submit the changes. remarks are required.$ Git commit-m "description"
4. Temporary changes (stash)Store changes that have not been submitted in the workspace to the temporary s
lack of any library files to install the appropriate library files.2. "Make make install", I encountered a troublesome error, yesterday afternoon the whole afternoon was not resolved, so the article is mainly to share this error and write.Error content: makefile:797: * * * must install Libyuv-dev to build MOD_FSV. Stop it.Solution:(1) Download LIBYUV source code and compileCD Freeswitch/libsgit clone https://freeswitch.org/stash/scm/sd/libyuv.gitCD
branch and switch to the pastgit Co-b #Create a new new_branch based on branchgit Co$id #Checkout A history commit record, but without branching information, switching to another branch will automatically deleteGit Co$idb #Checkout A History submission record and create a branchgit br-D #Delete a branchGit br-d #Force a branch to be removed (a branch that has not been merged will need to be forced when it is deleted)Branch Merging and Rebasegit merge # Merge branch branches into the c
can be discarded
The command git reset HEAD file can undo the staging area modification (unstage), re-put it back in the workspace, and then use git checkout -- file the discard work changes.
The command git rm is used to delete a file, and if it is found mistakenly deleted, replace the version git checkout -- file in the workspace with the version in the repository, which can be restored with one click, regardless of whether the workspace is modified or deleted.
git branch -b T
1. In the event of a conflict, the following information is indicated:' c/environ.c ' would is overwritten by merge. Aborting.please, commit your changes or stash them before you can merge.This means that there is a conflict between the updated content and the locally modified content, either by committing your changes or by temporarily storing the local changes first.The process is very simple, mainly using the git
repositoryFor example:If the user works in a 8705c repository, the remote repository for 8703c is aliased:git remote add 8703C [email protected]:~/repo/8703c-ap.gitThen, you can get any branch of 8703c by using the alias 8703C in the 8705c version of the repository.git fetch 8703C//sync 8703c to 8705c version LibraryGit branch-a//Display all branch information for 8703c and 8705cgit chekcout--track 8703c/branch_aPull the remote branch of 8703C to the local repository of 8705c,and automatically
the last commit information for each branchgit br--merged # View branches that have been merged into the current branchgit br--no-merged # View branches that have not been merged into the current branchGit Co Git co-b git co-b Git Co $id # Checkout A history commit record, but without branching information, switching to another branch will automatically deleteGit co $id-B git br-d git br-d Branch Merging and Rebasegit merge git merge origin/master--no-ff # do not fast-foward merge so you can ge
switch to another branch, the content you edited on the previous branch is not visible.To merge two branches, use the git merge branchname command.The default merge is Fast forward mode, which discards historical information and discards historical information when the branch is deleted. If you use--NO-FF, you can disable the FF mode, and a new commit will be generated when you merge, and you can see the branching information from the branch history.git branch-d branchname Delete a branchWhen e
configured remote warehouse and the corresponding address git remote -v Add a remote repository git remote add [remote-name] [url] Capture data from a remote repository git fetch [remote-name] [branch-name] Push data to a remote repository git push [remote-name] [branch-name] View a remote warehouse information git remote show [remote-name] Renaming a remote repository git remote rename [old-name] [new-name] Delete a remote warehouse git remote rm [remote-name] Show existing labels git tag Sear
commandgit stashPost a work backup after a temporary cleanup workspace as a repository for urgent modification of defect scenariosgit stash listView the work site for backupgit stash applyResume work sitegit stash dropDelete the previous backup sitegit stash popRestore and then delete the previous backuprebase command
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.