Branching
Branch
git branchThe git branch command allows you to create, list, rename and delete branches.
Create Branch
git branch branchName
Ex: git branch DemoList Branch
git branch or git branch --listDelete Branch
git branch -d branchName
Ex: git branch -d DemoRename Branch
git branch -m branchName
Ex: git branch -m Demo1Delete Remote Branch
git push origin --delete branchName
Ex: git push origin --delete DemoCheckout
git checkoutYou can switch between two branches with the git checkout command.
git checkout branch Name
Ex: git checkout DemoCreate and switch Branch
git checkout -b branchName
Ex: git checkout -b DemoDiscord changes
git checkout --test.txtMerge
You can merge two branches with the help of git merge command.
git merge
Ex: git merge branch NameMerge into other branch
git merge source branch target branch
Ex: git merge Demo1 DemoCherry-pick
Cherry-picking in Git stands for applying some commit from one branch into another branch.
git cherry-pick commit-ID
Ex: git cherry-pick 1dsfe345Rebase
Rebasing is a process to re apply commits on top of another base commit.
git rebase
Ex: git rebase DemoContinue to apply changes
git rebase --continueSkip changes and apply
git rebase --skipStash
Switch branches without committing the current branch.
git stashSave Stash
git stash save “Msg”List Stash
git stash listApply Stash
git stash apply stash ID
Ex: git stash apply 1dsfe345Show Changes
git stash show or git stash show -pLast updated