Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

git checkout to previous commit

# git: checkout to previous commit

git checkout HEAD~X # x number of commits to go back

# Go back one commit:
git checkout HEAD~1
Comment

git checkout previous commit HEAD

git checkout <commit_id>
git checkout -b <new branch> <commit_id>
git checkout HEAD~X // x is the number of commits to go back
Comment

git checkout previous commit

git reset --hard HEAD~10
To rollback 10 commits back:
Comment

git checkout previous commit

$ git reset --hard <commit_id>
Comment

checkout master with previous commit

git checkout 307a5cd        # check out the commit that you want to reset to 
git checkout -b fixy        # create a branch named fixy to do the work
git merge -s ours master    # merge master's history without changing any files
git checkout master         # switch back to master
git merge fixy              # and merge in the fixed branch
git push                    # done, no need to force push!
Comment

PREVIOUS NEXT
Code Example
Shell :: bash count number of arguments 
Shell :: oh my zsh apple m1 
Shell :: ERROR: database "backend" is being accessed by other users DETAIL: There are 3 other sessions using the database. 
Shell :: ubuntu get external ip 
Shell :: assign home directory to user linux 
Shell :: git name repository 
Shell :: install bpytop 
Shell :: gitignore global example 
Shell :: restart a pod kubernetes 
Shell :: windows proxy for local system 
Shell :: ubuntu capture screen 
Shell :: postgres output to bash variable 
Shell :: less command 
Shell :: ionic start server 
Shell :: check process on port linux 
Shell :: substring replacement 
Shell :: linux list top cpu processes 
Shell :: install xampp on Linux 
Shell :: terminal matrix effect 
Shell :: grep multiple 
Shell :: install python module ImageTk 
Shell :: how to install limma in r 
Shell :: touch command not working in vscode 
Shell :: delete github credentials in windows 
Shell :: deploy netlify angular 
Shell :: stop supervisor service centos 8 
Shell :: nuxt install pug 
Shell :: xsltproc linux install 
Shell :: powershell delete folder contents 
Shell :: nodemon script 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =