When you commit to git, then you push and get rejected:
To prevent merging with your local and making your git history filthy, reset head to the latest commit (head~1):
Now git pull and the commit again and push. The world is cleaner now.
#git #reset_head #merge #repository
$ git push
To my_repo:~/my_project.git
! [rejected] dev -> dev (fetch first)
error: failed to push some refs to 'my_repo:~/my_project.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
To prevent merging with your local and making your git history filthy, reset head to the latest commit (head~1):
$ git reset HEAD~1
Unstaged changes after reset:
M another_file_here.py
M some_file_here.py
Now git pull and the commit again and push. The world is cleaner now.
#git #reset_head #merge #repository