How to creat another branch based on one branch with an older commit

your current branch is : X
Branch X has a commit id is <sha1-of-commit>
then you use this below command
git branch Y <sha1-of-commit>
OR    
git branch Y HEAD~3   
  • HEAD means (the reference to the) current commit
  • HEAD~1 means (the reference to) 1 commit before
  • HEAD~ ALSO means (the reference to) 1 commit before
  • HEAD~87 means (the reference to) 87 commits before

==> you are creating a new branch called Y with the lastest commit is <sha1-of-commit>

Comments

Popular posts from this blog

Fixing the DeepSpeed Import Error While Fine-Tuning the Qwen Model

Amazon Linux 2023 - User data configuration for launch templates to connect to the EKS cluster

How to create ISM policy and rotate logs in opensearch