1)working directory (WD)
"git diff" shows diffs between your WD and INDEX"git diff someCommit" shows diffs between your WD and a COMMIT
"git diff someBranch" shows diffs between your WD and a the tip of the BRANCH
"git add -u" stages updated/modified files (but not new files)
2)index / staging area (INDEX)
"git reset someFile" unstages someFile (but keeps changes)3)COMMIT (or HEAD which is really just the last commit of the active branch)
"git diff commitA commitB" will show the differences between those to commits. order matters."git show someCommit" will show changes of that commit (implied to previous commit)
"git diff branchA branchB" OR "git diff branchA..branchB" both will show the diff between the tips of the two branches.
"git diff branchA...branchB" will show the difference between those 2 branches common ancestor (aka merge-base) and branchB
source: http://stackoverflow.com/questions/7251477/what-are-the-differences-between-double-dot-and-triple-dot-in-git-dif/7252067#7252067
double-dot: "git log branchA..branchB" shows the commits branchB has that branchA does NOT
triple-dot: "git log branchA...branchB --left-right" shows the commits branchB has that branchA does NOT -and- the commits branchA has that branchB does NOT.
source: http://stackoverflow.com/questions/462974/what-are-the-differences-between-double-dot-and-triple-dot-in-git-com
source: source: http://stackoverflow.com/questions/7251477/what-are-the-differences-between-double-dot-and-triple-dot-in-git-dif/7252067#7252067
"git reset someCommit" destroys all commits after someCommit, preserves changes locally
"git reset --hard someCommit" destroy all commits after someCommit, Destroys changes locally
"git revert someCommit otherCommit" create a commit with the reverse patch to cancel it out. both commits will be listed in the history
source: http://stackoverflow.com/questions/4114095/revert-to-a-previous-git-commit
"git log" show commits for current branch
"git log --follow someFile" some commits where someFile was part of commit
4)Remote
todoresources:
- https://training.github.com/kit/downloads/github-git-cheat-sheet.pdf
- http://ndpsoftware.com/git-cheatsheet.html
- https://git-scm.com/docs
No comments:
Post a Comment