Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

git command change to previous comit

git revert --no-commit 0766c053..HEAD
git commit


If you really do want to have individual commits 
(instead of reverting everything with one big commit), 
then you can pass --no-edit instead of --no-commit, 
so that you don't have to edit a commit 
message for each reversion. – user456814
Comment

git command change to previous comit

# Checkout a given commit.
# Doing so will result in a `detached HEAD` which mean that the `HEAD`
# is not pointing to the latest so you will need to checkout branch
# in order to be able to update the code.
git checkout <commit-id>

# Create a new branch forked to the given commit
git checkout -b <branch name>
Comment

git command change to previous comit

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

git command change to previous comit

git reflog
git checkout HEAD@{...}
Comment

git command change to previous comit

# This will create three separate revert commits:
git revert a867b4af 25eee4ca 0766c053

# It also takes ranges. This will revert the last two commits:
git revert HEAD~2..HEAD

#Similarly, you can revert a range of commits using commit hashes (non inclusive of first hash):
git revert 0d1d7fc..a867b4a

# Reverting a merge commit
git revert -m 1 <merge_commit_sha>

# To get just one, you could use `rebase -i` to squash them afterwards
# Or, you could do it manually (be sure to do this at top level of the repo)
# get your index and work tree into the desired state, without changing HEAD:
git checkout 0d1d7fc32 .

# Then commit. Be sure and write a good message describing what you just did
git commit
Comment

PREVIOUS NEXT
Code Example
Shell :: December festivities 
Shell :: linux less go to last line 
Shell :: ubuntu burg install 
Shell :: oracle vm cannot install guest edition windows 10 enterprise 
Shell :: coc.nvim not working after update 
Shell :: how to check the requirement of a package in pip 
Shell :: cancel jobs related to one name 
Shell :: c pipe 2 arguments 
Shell :: does among us exist for linux 
Shell :: netplan reload 
Shell :: sc windows 
Shell :: ispconfig auto installer 
Shell :: asus router reset cache 
Shell :: unique IP active connections on server 
Shell :: louch tensorboard on remote server 
Shell :: linux terminal clear shortcut 
Shell :: composer install repo from tar 
Shell :: CLONE DISK LINUX 
Shell :: bash comparison operators 
Shell :: Save Resources in K8s, Delete Failed Pods 
Shell :: hidden files filsize in linux 
Shell :: git commands cheat sheet pdf 
Shell :: docker linux install 
Shell :: delete all git ignored files 
Shell :: install freepbx on ubuntu 18.04 
Shell :: How to Install and Configure doctl Github Download (Linux, MacOS) 
Shell :: Problem with MergeList /var/lib/apt/lists/developer.download.nvidia.com_compute_cuda_repos_ubuntu2204_x86%5f64_Packages 
Shell :: bash script colors 
Shell :: how to update azure data studio on ubuntu 
Shell :: create ovpn file linux 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =