Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

undo commit git before push

git reset HEAD~      
Comment

undo git commit after push

git reset <hash> # Run this then merge, commit, and push
Comment

how to undo commits after push

You can revert individual commits with:

git revert <commit_hash>
This will create a new commit which reverts the changes of the commit you specified. Note that it only reverts that specific commit, and not commits that come after that. If you want to revert a range of commits, you can do it like this:

git revert <oldest_commit_hash>..<latest_commit_hash>
It reverts all the commits after <oldest_commit_hash> up to and including <latest_commit_hash>. On some versions of git it also reverts the <oldest_commit_hash>, so double check if that commit gets reverted or not. You can always drop the latest revert commit (which reverts the oldest commit) with g reset --hard HEAD~.

To know the hash of the commit(s) you can use git log.

Look at the git-revert man page for more information about the git revert command. Also, look at this answer for more information about reverting commits.
Comment

PREVIOUS NEXT
Code Example
Shell :: kubectl restart recreate pod 
Shell :: svg to png convert imagemagick 
Shell :: bash if number greater than zero 
Shell :: how to encrypt and decrypt a text file using openssl rsa public and private keys 
Shell :: github setup local 
Shell :: clear command in linux 
Shell :: copy to clipboard while ssh into another terminal 
Shell :: gitlab runner on docker 
Shell :: git diff 
Shell :: how to view the list of your environments in your terminal or Anaconda prompt 
Shell :: bash append to a file 
Shell :: bash get files older than 
Shell :: wsl distro 
Shell :: install flutter 
Shell :: bash cut delimiter multiple spaces 
Shell :: how to git push to current branch 
Shell :: helm install with values file 
Shell :: how to ssh to another computer 
Shell :: uninstall awesome window manager ubuntu 
Shell :: libqt5core5a is not installed. 
Shell :: leave azure ad cmd 
Shell :: sqlite://// ubuntu path 
Shell :: install pillow error alpine linux 
Shell :: installation caffe 
Shell :: commands for ssh 
Shell :: adb kill server kali linux 
Shell :: veil framework install 
Shell :: git setup upstream 
Shell :: The process cannot access the file because it is being used by another process. Press any key to continue... 
Shell :: how can I specific line in ubuntu? 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =