Thursday, August 18, 2022

Git Useful commands

Revert last merge commit

  1. git revert -m 1 "commit which you want to revert"
  2. git push -u origin master or git push                

Delete your merge commit from remote branch

  1.     git reset --hard "commit where you want to go" .   all commits after that will be deleted after both these steps.
  2.   git push --force
Squashing multiple commits into a single one
  1.    git rebase -i head~10
  2.    replace pick to s for the commits that hasto be merged 
reference ->   https://www.youtube.com/watch?v=gXCkYkLQ3To&ab_channel=BigBinary

Replace folder from another branch

git rm -r /path/to/folder
git checkout OTHER_BRANCH -- /path/to/folder

No comments:

Post a Comment

Git Useful commands