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 :: powershell convert to exe 
Shell :: bash get file full path 
Shell :: git create new repo 
Shell :: how to change branch name in github 
Shell :: # Check failed: allocator-SetPermissions(reinterpret_cast<void*(region.begin()), region.size(), PageAllocator::kNoAccess). 
Shell :: requirements.txt conda 
Shell :: wget save file with different name 
Shell :: github visualise branches 
Shell :: install krew 
Shell :: ubuntu alien install 
Shell :: Use pip to install the EB CLI. 
Shell :: change user linuxcommand ch 
Shell :: how to undo a commit sent that was pushed 
Shell :: sudo doesnt work on windows 
Shell :: bin/sh sam: not found 
Shell :: how to remove a non empty directory in linux 
Shell :: powershell get aliases 
Shell :: create batch file to delete folders 
Shell :: how to install packages from jupyter notebook 
Shell :: ubuntu errors were encountered while processing libc-bin 
Shell :: git log filter merge commits 
Shell :: curl head request 
Shell :: specify origin git 
Shell :: install react-native-community hooks 
Shell :: install spring boot on ubuntu 
Shell :: awk columns 
Shell :: command get full history terminal mac 
Shell :: homebrew installation 
Shell :: git push in a new branch 
Shell :: how to git clone from a specific branch git 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =