Posts

Showing posts with the label branch

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>

delete branch in git

To delete a local branch git branch -d yourBranchName --------- To force delete a local branch git branch -D yourLocalBranch -------------- To delete a remote branch git push origin --delete remoteBranchName