for all branch history # git revert modification corresponding to the submission history # undo commit dfb02e6e4f2f7b573337763e5c0013802e3 92818git ls-tree HEAD # Internal Command: display a git object git rev-parse v2.0 # Internal Command: Display SHA1 HASHgit reflog for a ref # Show All commits, including the isolated node
branch of the remote repository for all versions, sub-branches only for local development and upload changes, so all pull should be pulled to master, instead of directly to the pulling sub-branch, and then through the merge The master implementation merges with the master sub-branch:
$ git checkout master (switch from current branch to main branch)
$ git pull (pulls the current version of the remote reposi
(removed from registers and workspaces)
Git diff--cached or $ git diff--staged view updates that have not yet been submitted
Git stash push to push the file to a temporary space
git stash pops down files from temporary space
----
the mode to be disabled, Fast forward git will generate a new commit at merge, so you can see the branching information from the branch history.
To prepare the merge dev branch, note --no-ff The parameter, which indicates disabled Fast forwar :
$ git merge--no-ff-m "merge with No-ff" Dev
You need to add-m to it because a new branch is created and you need to add a description
13.bug Branch
Git commands can be sorted in Chinese and git commands in Chinese.
Git command quick query table Chinese Version
Create
Copy A created warehouse:
$ git clone ssh://user@domain.com/repo.git
Create a new local repository:
$ git init
Local Modification
Display the
details stash // a cache mechanism Status // view git status gitk // graphical interface to view all the COMIT of the current branch, similar to the gitlog GUI version
Most git commands require the current directory (or the ancestor directory of the current directory) to exist. the GIT folder can be executed only in t
# Create a new branch and switch past git co-b # Create a new New_branchgit co # to checkout a history commit record, But without branching information, switching to another branch will automatically delete the Git co $id-B # Make a history commit record checkout out, create a branch git br -d # Delete a branch git b
branches to the current branch git merge origin/master -- no-ff # Do not merge Fast-Foward, so that you can generate merge to submit git rebase master
# Rebase the master database to branch, which is equivalent to: git co
Git rebase master git co master
, it's usually checkout to make sure there's no conflict.-M"Merge" //Tips for Merging*********************************************************************************************see the following situation to pay attention to conflict. Don't forget to resolve the conflict.*********************************************************************************************master should be published directly. So there should be no conflict when merging to master, so it is not recommended that multi
, and you won't be able to show it at this stage (before you go back to the change). In this case, git stash can help you. Stash essentially takes all the changes and stores them for future use. Stash your changes, you simply run the following command-?
1
gitstash
a specific file with --, for example:$ Git checkout -- DIR/Main. c
Git has several built-in symbol index pointers:Head: always points to the latest commit of the current branch.Orig_head: After git reset or git merge, the original head is stored hereFetch_head: Head index pointer of all branches after
corresponding hello.txt file and find that the two lines you modified exist in the file in this form:
In this way, the content in different branches is marked and you need to manually change it and submit it with $ git add hello.txt and commit-M.
Use the $ git log with parameters to view the merging information. Take note of the parameters later.
$ git log --gr
normal mode, the merged history has branches, can be seen to have been merged, andfast forwardThe merger would not have been seen as a merger.$ git merge--no-ff-m "merge with No-ff" Devmerge made by the ' recursive ' strategy. Readme.txt | 1 + 1 file changed, 1 insertion (+)13.When fixing a bug, we will fix it by creating a new bug branch, then merging and finally deleting;When the work is not finished, first put the job site
corresponding hello.txt file and find that the two lines you modified exist in the file in this form:
In this way, the content in different branches is marked and you need to manually change it and submit it with $ git add hello.txt and commit-M.
Use the $ git log with parameters to view the merging information. Take note of the parameters later.
$ git log --gr
diff--cached
This allows you to take a look at the modification details before commit.
5. Do not create a synchronization of useless merge
There is a situation where a branch is dedicated to synchronizing code provider code, and if the general pull will constantly produce a merge that looks annoying, adding a--rebase with the use below will not create a useless merge.
$ git Pull--rebase Origin master
6. About S
information is discarded after the branch is deleted, that is, the merge cannot be seen once. Adding the--NO-FF parameter can prohibit the use of Fast forward mode, the merged history has branches, can be seen to have been merged.In the actual development, the master branch should be very stable, only to release the new version, usually do not work on it;The Dev branch is unstable, and at some point, the Dev branch is merged to master;Everyone works on the dev branch, and sometimes merges on th
demand, suddenly this self-happy development way is interrupted, a test branch has a bug needs to be repaired immediately, wipe, the local code has not been submitted, but do not want to because of the temporary submission of local code to describe how the temporary submission of the description. You can then use Git stash to access locally changed code, and then switch to the bug's branch to solve the pro
Git's first use Git common command query Git push Git pull before introducing installation and simple use, let's take a look at The introduction in Baidu Encyclopedia: ---------------------------------- Git --- The stupid content tracker, dummies content tracker. In Linux, we will introduce
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.