Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

github delete last commit

git push -f origin HEAD^:master
Comment

git delete last commit

---- [Temporarily switch to a different commit] ----
# If you want to temporarily go back to a particular commit, fool around, 
# then come back to where you are
> git checkout 0d1d7fc32

# Or if you want to make commits while you're there, 
# go ahead and make a new branch while you're at it:
> git checkout -b old-state 0d1d7fc32 

---- [Hard delete unpublished commits] ----
# If, on the other hand, you want to really get rid of everything you've done
# since then, there are two possibilities.
# One, if you haven't published any of these commits, simply reset:

# This will destroy any local modifications.
# Don't do it if you have uncommitted work you want to keep.
> git reset --hard 0d1d7fc32

# Alternatively, if there's work to keep:
> git stash
> git reset --hard 0d1d7fc32
> git stash pop
# This saves the modifications, then reapplies that patch after resetting.
# You could get merge conflicts, if you've modified things which were
# changed since the commit you reset to.
Comment

git delete last commit

git push origin HEAD --force
Comment

PREVIOUS NEXT
Code Example
Shell :: navigate to folder on mac 
Shell :: stop port 
Shell :: shell case example 
Shell :: git view stash 
Shell :: git how to undo a pushed commit 
Shell :: deleting remote branch in GitHub 
Shell :: firebase deploy with token 
Shell :: how to zip my files without ds_store 
Shell :: command to install express graphql 
Shell :: linux DNS_PROBE_FINISHED_NXDOMAIN 
Shell :: multiple kubeconfig in one file 
Shell :: install native run 
Shell :: conky ubuntu 20.04 install 
Shell :: linux get first line of file 
Shell :: docker install ubuntu 20 
Shell :: how to install wireshark 
Shell :: clear arp table ubuntu] 
Shell :: npm install dev dependencies 
Shell :: move all files in a directory linux 
Shell :: superclass mismatch for class Command ruby 
Shell :: uninstall all microsoft apps powershell 
Shell :: ubuntu move all files in directory 
Shell :: wsl2 file location 
Shell :: command get full history terminal mac 
Shell :: how to install homebrew 
Shell :: git push origin master not working 
Shell :: ssh transfer folder 
Shell :: delete files 0 bytes linux 
Shell :: stop nginx service 
Shell :: mac flutter sdk path 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =