Git Hacks

git rebase -i HEAD~2 
git reset --soft HEAD~1
git reset --hard HEAD~1
git commit --amend 
git subtree add -P SRC_DIRECTORY ssh://git@REPO_URL master
git clone SOURCE_REPOcd SOURCE_REPOgit remote rm origin git filter-branch --subdirectory-filter SOURCE_REPO -- --all 
git clone DEST_REPO cd DEST_REPO git remote temp_origin PATH_TO_PREVIOUSLY_PREPARED_REPO_ABOVE git pull temp_origin master --allow-unrelated-histories git remote rm temp_origin git push 
git filter-branch --index-filter 'git rm --cached -qr --ignore-unmatch -- . && git reset -q $GIT_COMMIT -- $DIR1 $DIR2 $DIR3' --prune-empty -- --all\n

--

--

A hands on engineer/leader with experience designing and developing embedded, cloud and enterprise software.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Srikanth Kavoori

Srikanth Kavoori

1 Follower

A hands on engineer/leader with experience designing and developing embedded, cloud and enterprise software.