Amend a commit
1 2
| git fetch remote <branch_name> git merge <commit_hash>
|
1 2
| git fetch origin git reset --hard origin/master
|
Warning
This command would remove all stashed objects.
1 2
| git reflog expire --expire-unreachable=now --all git gc --prune=now
|
Remove a file
Remove a folder recursively
1
| git rm -r --cached <folder>
|
If the following code is executed accidentally
1 2
| git stash pop git checkout -- .
|
First, use gitk to find the corresponding hash value
1
| gitk --all $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )
|
Then, run git stash to apply the stash entry
1
| git stash apply <stash_hash>
|