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 :: creating a 2d array in a script in linux shell 
Shell :: generate certificate ssl 
Shell :: find change permissions to subdirectories 
Shell :: git remove ignored files 
Shell :: docker images only name 
Shell :: git pull with ssh 
Shell :: debian get minor version 
Shell :: generate ssh key 
Shell :: delete branches gitlab 
Shell :: how to run script in linux at startup 
Shell :: find exec rm 
Shell :: how to get the files using the most storage ubuntu 
Shell :: replace char for new line 
Shell :: powershell for each loop 
Shell :: kill running port in ubuntu using procees id 
Shell :: save docker update container state 
Shell :: sh vs bash 
Shell :: docker remove image 
Shell :: bash else if 
Shell :: set head of branch at specific commit 
Shell :: linux strip foldder name from path 
Shell :: docker pull image 
Shell :: install laravel dompdf 
Shell :: centos 7 openldap install 
Shell :: how to install choclatey using command prompt 
Shell :: php enable extension lphp.ini 
Shell :: conda install pandas 
Shell :: how to install wireshark on fedora 
Shell :: how to install react redux 
Shell :: how to install tesseract in other language in linux 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =