diff options
| author | srdusr <[email protected]> | 2023-07-03 23:52:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2023-07-03 23:52:00 +0200 |
| commit | d0ffb9b07bb59183ab499dbaf8782aea1f47d7c7 (patch) | |
| tree | caa55b27177fb57f8170de68730a3c6443fc8b00 /tools/git.md | |
| parent | cced26043e42aeba99197861e77410486f9a4b77 (diff) | |
| download | notes-d0ffb9b07bb59183ab499dbaf8782aea1f47d7c7.tar.gz notes-d0ffb9b07bb59183ab499dbaf8782aea1f47d7c7.zip | |
Add info about diff
Diffstat (limited to 'tools/git.md')
| -rw-r--r-- | tools/git.md | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/git.md b/tools/git.md index 2e962d2..52a4ba2 100644 --- a/tools/git.md +++ b/tools/git.md @@ -38,6 +38,7 @@ 3. Set up the alias 'config' ```bash $ alias config='/usr/bin/git --git-dir=<path to .cfg’s Git directory> --work-tree=$HOME' + alias config='git --git-dir=$HOME/.cfg --work-tree=$HOME' ``` 4. Set local configuration into .cfg to ignore untracked files ```bash @@ -123,6 +124,35 @@ other's existence: ```bash $ git pull origin <branch> --allow-unrelated-histories ``` +Diff between commits +``` +$ git log +$ git diff (checkout_id):file.txt file.txt +or +$ git diff <commit_id1> <commit_id2> +or +$ git difftool <commit_id1> <commit_id2> + +``` + + +If the top commit is pointed to by HEAD then you can do something like this: + +commit1 -> HEAD +commit2 -> HEAD~1 +commit3 -> HEAD~2 + +Diff between the first and second commit: + +git diff HEAD~1 HEAD + +Diff between first and third commit: + +git diff HEAD~2 HEAD + +Diff between second and third commit: + +git diff HEAD~2 HEAD~1 - - - #### Miscellaneous Find out size of a repo before cloning it |