GIT Cheat Sheet (ToDo)

Revert Git Commit which has not been Pushed

  • Undo the last commit and keep all files staged: git reset --soft HEAD~
  • Undo the last commit and un-stage all files: git reset HEAD~
  • Undo the last commit and completely remove all changes: git reset --hard HEAD~

Undo Pushed Commit

               git revert <commit_hash>


Issue: 
    There is no tracking information for the current branch.
  Please specify which branch you want to merge with.
Solution: 
              git config --global push.autoSetupRemote true

Then a simple git push would be the same as git push --set-upstream-to=origin/main main, making the next git pull already set to retrieve commits from origin/main.


Comments