projects:progit:inspection
This is an old revision of the document!
Table of Contents
Inspecting Git repository
Te Three Main States
State | Location | Description | Method of inspection |
---|---|---|---|
Commited | .git directory | Stored in DB | git log |
Modified | Working directory | Changed | git status git diff |
Staged | Staging area (.git/index) | Changed and marked for next commit to the DB | git status |
Specifying revision
There are many ways to distinguish a specific commit from Git repository.
- SHA (hash) - The SHA-1 algorithm is used to create a unique 40-byte hexadecimal string in many corners of git. The SHA (hash-object cat-file)
- (refnames, refs)
- Branch reference (heads) - Branches in Git are nothing more than pointers to the commit. Branch reference is a SHA value of the most recent commit and it is updated with each new commit added. (show rev-parse show-ref)
- Tag reference - Similar to Branch reference but does not change with new commits. (git describe)
- HEAD (@) - Note the capital letters. Points to the current commit. (git describe)
- Other like FETCH_HEAD, MERGE_HEAD, CHERRY_PICK_HEAD, ORIG_HEAD
- <refname>@{<date>} - For example
master@{yesterday}
,HEAD@{5 minutes ago}
. Note: Date parsing is undocumented but the parser code can be accessed on github. - <refname>@{n} - For example
master@{7}
returns 7th prior commit from master head. - <refname>@{-n} - For example
@{-2}
returns 2nd commit checked out before current one. - <branchname>@{upstream}
git rev-parse –symbolic-full-name @{u}
- <rev>^n
- <rev>~n
- <rev>^{type} - difference commit tag
Diff
Debugging with Git
blame | |
grep | |
bisect |
References
projects/progit/inspection.1455572750.txt.gz · Last modified: 2016/02/15 22:45 by mkucia