Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

git got to previous 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 go back to previous commit

git checkout 12feg3435 #commit ID
Comment

git how to rollback to previous commit

# Revert is the command to rollback the commits.
git revert 2h3h23233

# push after change
git push
Comment

how to move to previous commit in git

git checkout <commit-id> .
git add .
git commit -m "Reverting to <commit-id>"
git push
Comment

how to move to previous commit in git

$ git checkout <commit-id> .
Comment

rollback to a previous commit

git reset --hard <commidId> && git clean -f
Comment

git commit to previous commit

git commit --amend #will add the changes to the prev commit
Comment

PREVIOUS NEXT
Code Example
Shell :: gitignore still tracking files 
Shell :: install nodemon in express 
Shell :: wsl2 config file 
Shell :: git fetch only pull master 
Shell :: How to get Tab-Completions with microsoft vcpkg 
Shell :: Filter in terminal 
Shell :: stop running pre-commit hook: lint-staged 
Shell :: install installatron cpanel 
Shell :: ansible remove part of line 
Shell :: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0) 
Shell :: bash add options to script 
Shell :: Problem with MergeList /var/lib/apt/lists/developer.download.nvidia.com_compute_cuda_repos_ubuntu2204_x86%5f64_Packages 
Shell :: get installed app icon android kotlin 
Shell :: Running shell scripts 
Shell :: Hands-on GitHub Actions: Implement CI/CD with GitHub Action Workflows for Your Applications.pdf 
Shell :: linux .filename meaning 
Shell :: conflict: unable to remove repository reference sail 
Shell :: ex: "push a new local repository to github" 
Shell :: vim sensible linux 
Shell :: exit 0, run container in shell mode 
Shell :: Show All In Current Folder 
Shell :: docker compose kong 
Shell :: debian auto login 
Shell :: command to display topmost cpu intensive running processes 
Shell :: Payload retrieve sam and system from a live file system 
Shell :: mnet - git config user 
Shell :: Use Kubespray to deploy a Production Ready Kubernetes Cluster 
Shell :: KDE Connect Command PC turn off 
Shell :: remove data from realtime database 
Shell :: spryker install silex 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =