- Change post-update.sample to post-update
- Have the below command inside post-update
GIT_WORK_TREE=/home/path/to/working/dir/mytest git checkout -f
git rev-parse --short <branchname>
git diff master..dev
git diff dev..origin/master
OR
git diff master..origin/master
Upstream branch several commits ahead, you have some uncommitted changes (local configs for example)
git stash
git pull
git stash pop
And resolve any local conflicts
Reverting commits. Source
git reset <commit>
will reset your INDEX and NOT your files in your working tree back to <commit>/HEAD~#
AND the files will NOT be in the staging area (will be red instead of green with git status
)
Like git reset except the files will aready be in the staging area ready for commit (green instead of red)
git reset --soft [<commit>, HEAD~#]
Where # is num of commits
git reset --hard [<commit>, HEAD~#]
Where # is num of commits
git reset HEAD@{1}
To merge and either auto resolve with theirs or ours. Source
git merge --strategy-option theirs
git merge --strategy-option ours
git update-index --assume-unchanged [path/to/file]
git add -i
Use the ?
command to explain each command
When attempting to stage individual lines, use the e
command when staging hunks and follow the notes in the editor
[1] The only way I know how to reset a --hard reset is using the git reflog
command. Even then it only shows up for 90 days.