Git
Tools
MacOS
Windows
G Suite
Photo, Audio & Video Editing
Networking
Linux
Android
Dell XPS
Lenovo ThinkPad
Livestreaming
Misc
Git
Tools
MacOS
Windows
G Suite
Photo, Audio & Video Editing
Networking
Linux
Android
Dell XPS
Lenovo ThinkPad
Livestreaming
Misc
Oh-My-Zsh git command alias reference (kudos to thoughtworks)
git checkout -- path/to/file
git pull --rebase # or git pull --no-ff
List
git branch -a
Delete local
git branch -d test
Delete remote
git push origin --delete test
Cleanup branches on local which have been deleted on remote
git fetch --prune
git reset --soft HEAD^ # or git reset --soft HEAD~1
Then reset the unwanted files to leave them out from the commit:
git reset HEAD path/to/unwanted_file
Now commit again, you can even re-use the same commit message:
git commit -c ORIG_HEAD
git checkout origin/master -- src/main/java/HelloWorld.java git commit -m "Removed a modified file from pull request" git push origin <pull-request-branch>
https://stackoverflow.com/questions/39459467/remove-a-modified-file-from-pull-request
First, commit your current changes
git commit git checkout -b backup
Secondly, switch to the target branch
git checkout master
Thirdly, rebase the source branch onto the target branch
git rebase <parent commit hash BEFORE first feature commit> --onto <feature branch name> --committer-date-is-author-date