git command rollup

Source: Internet
Author: User

===================================================================== diff ====================================== ===============================

git diff--check Check for extra whitespace

git diff--cache--check check for extra whitespace

===================================================================== Log ======================================= ==============================

git log--no-merges does not display the merge log

git log--no-merges branch1...branch2 display in BRANCH2 but not in Branch1 commit information

$ git log--abbrev-commit--pretty=oneline             show Sha1th short Unique ca82a6d changed the version number085bb3b removed Unnecessary test CODEA11BEF0 First commit

git log--oneline--decorate--graph--all like GITK--all

 $ git log-g master view reference log information similar to the GIT log output format commit 734713BC 047d87bf7eac9674765ae793478c50d3reflog: [email protected]{ 0 } ( Scott Chacon <[email protected]>) Reflog message:commit:fixed refs handling   , added GC auto, Updatedauthor:scott Chacon  <[email protected]>date: Fri Jan  2  18 : 32 : 33  2009 -0800   fixed refs handling, added GC auto, updated tests 

git log master. Experiment view commits in the experiment Branch, and the commit is not in the master branch

git log origin/master.   HEAD to view commits that are not in the remote in the current branch. In.. On either side, if one side is empty, the default is head

$ git log refA. RefB                        ^--not RefA
$git log refA refB ^refc $ git log refA refB--not REFC      all refA or refB contained but not refC included commits

git log master...experiment View non-common commits on two branches--equivalent to executing git log master. Experiment results plus the GIT log experiment is executed again. Results of Master

git log--left-right master...experiment, but shows which branch the commit belongs to

Git show--name-only 3c0d42bd33f9bd1da50e858d6a7f52f6b35707b6 shows the file name affected by this commit

====================================================================== Reflog =================================== =================================

The $ git reflog       reference log exists only in the local repository, a log that records what you did in your own warehouse. The reference log in the repository copied by others will not be the same as yours, and when you clone a repository, the reference log is empty because you are not operating in the repository. 734713b [email protected]{0}: commit:fixed refs handling, added GC auto, updatedd921970 [email protecte d]{1}: Merge Phedders/rdocs:merge made by recursive.

====================================================================== Show ===================================== ===============================

$ git show [email protected]{5}$ git show [email protected]{yesterday}           shows which submission was pointed at the top of the branch yesterday. This method is only useful for data that is still in your reference log .

$ git show [email Protected]{2.months.ago}
$ git show d921970^$ git show d921970^2                          Second Parent commit
$Git show head~3                             third Parent Commit
$Git show head^ ^^

==================================================================== Rev-parse ================================== ====================================

$ git rev-parse topic1              View the branch's SHA1 value ca82a6dff817ec66f44342007202690a93763949

==================================================================== Branch ================================= =====================================

$ git Branch        local branch*-R     Remote Branch  origin/-a     all branch * Master  remotes/origin/master
$ git branch-v2in-vv        display trace relationship 2 in Libs

Git branch--ser-upstream [local branch] [remote branch]

================================================================= Add =========================================== ==============================

git add-i Interactive Staging

Git add-p staged partial patches, equivalent to git add--patch

================================================================= Stash ========================================= =================================

git stash or git stash save

git stash List

git stash apply ==> git stash apply [email protected]{0}

git stash apply [email protected]{1}

Git stash Apply--index if there is staged before stash, use the change command is still staged, otherwise changed and not in staged

git stash pop ==> git stash apply [email protected]{0} + git stash drop [email protected]{0}

git stash pop--index

git stash drop ==> git stash drop [email protected]{0}

git stash drop [email protected]{1}

Git stash--keep-index only stores staged

git stash-u or git stash--include-untracked also stores files that are not tracked

Git stash--patch save only a certain part

git Stash branch [new branch] ==> git checkout-b [new branch] + git stash pop

git stash--all Remove files that are not being traced and store them in the stack

================================================================ Clean ========================================== ================================

Git clean removes files that are not tracked

Git clean-d Remove a directory that is not tracked, including files in that directory

git clean-f forcing removal

Git clean-n-n is used to do a drill and then tell you what you 're going to remove.

git clean-i interactive mode

The git clean-x git clean command only removes non-tracked files that are not ignored, and any .gitiignore files that match the pattern in the file or other ignored files are not removed. If you also want to remove those files, you can add an option to the clean command -x

=============================================================== Checkout ======================================== ==================================

git checkout--conflict=merge [conflict file] back to the state when [conflict file] did not resolve the conflict

git checkout-b [New branch] [old branch]

================================================================ revert ========================================= =================================

git revert-m 1 head-m Select the state of the branch to return to, 1 represents the current branch at merge, and 2 represents the branch to merge. Revert represents the deprecated branch (the current command indicates that 1 is selected, 2 is not selected).

git revert [SAH-1] to not discard unselected branch content in a re-merge, you need to flip again

================================================================ Blame ========================================== ================================

git blame [file] Callout file, view the last modification time of each line of this file and modify the author

git blame-l 5,15 [file]-L is used to restrict which rows are viewed

Git blame-c-L 5,15 [file]-C for viewing the original source of each row

================================================================ bisect ========================================= =================================

$ git bisect start$ git bisect bad$ git bisect good [good version]...$ git bisect reset$ git bisect start [bad version] [g Ood Version]

================================================================ Bare =========================================== ===============================

Git init--bare

git clone--bare [a repo] [a remote repo you want to create (named. Git at the end)]

================================================================ Remote ========================================= =================================

git remote add [remote-ref-new-name] [url]

Git remote-v

git remote show [remote-ref-name]

git remote rename [old name] [new name]

Git remote RM [Remote-ref-name]

================================================================ submodule ====================================== ====================================

git submodule add [url]

git submodule add [url] [Remote-ref-new-name]

$ git clone [url]                          --recursive [url]             equivalent to the above three commands

================================================================ Clone ========================================== ================================

git clone [url]

git clone [url] [local dir name]

git clone-o [alternative name for Origin] [url]

git command rollup

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.