5. WHAT IS SHA?
A commit is uniquely identified by a 160-bit hex value (the 'SHA'). This is computed
from the tree, plus the following pieces of information:
- the SHA of the parent commit(s) -- every commit except the very first one in the repo
has at least one parent commit that the change is based upon.
- the commit message -- what you type in the editor when you commit
- the author name/email/timestamp
- the committer name/email/timestamp
7. .gitignore
• * Matches zero or more characters
•[abc] matches any character inside brackets- a, b, or c
• ? Matches a single character
• [0-9] brackets enclosing characters separated by a hyphen matches any
characters between them
• ** two asterisks to match nested directories a/**/z matches a/z, a/b/z
etc.
10. Git Remove…
• If you want to keep a file in working tree but remove it from your staging area
you can use
You can also pass file directories and blobs to git rm command like so.
11. Popular Git Log Commands
• Using –p in git log shows differences introduces in each commit
• Using a –n(number) will show you the last n commits
12. Popular Git log Commands
• Git log Stat give you abbreviated stats for each commit
13. Popular Git Log Commands
• Git log –-pretty = oneline prints commits on oneline (useful for lots of
commits)
19. Undoing things
• If you want to unstage a file from a commit
Use git reset HEAD <file>
20. Undoing more things
• If you have a file that is not staged and you want to get rid of all the
changes and revert the file back to its last commit do …
21. A little bit on tagging
• Git has the ability to tag specific points in the history as being important
(usually a version release of a project or something along those lines)
• Run git tag - a
Git show ill show you tag data along with commit that was tagged
22. A bit more tagging
• You can add tags to commits after you have moved past them.
• You can look at your commit history and do the following
You can also create a new branch based on the commit history of a specific tag by
doing
25. Git Rebase
• Instead of merge you can use rebase
26. For next time
For next time:
-Stashing
-Cherry-picking
-More complex merge conflicts
-Any things the group would like to look into
Editor's Notes
Git diff shows you what you have changes but have not yet stages. Git staged shows you what changes you have stages for the next commit
Generally you do not want to use git checkout –file unless you know exactly what you want to do with the file.
Merge command takes to more recent branch snapshots and a common ancestor
So git goes to the common ancestor of the branch that you are on and the branch that you are rebasing into. Gets the diff introduced by the branch you are on and saves those diffs into temporary files, then it resets the current branch to the same commit as the branch you are rebasing into. And applies all the diffs.