Branching
Branch
git branch
The git branch command allows you to create, list, rename and delete branches.
Create Branch
git branch branchName
Ex: git branch Demo
List Branch
git branch or git branch --list
Delete Branch
git branch -d branchName
Ex: git branch -d Demo
Rename Branch
git branch -m branchName
Ex: git branch -m Demo1
Delete Remote Branch
git push origin --delete branchName
Ex: git push origin --delete Demo
Checkout
git checkout
You can switch between two branches with the git checkout command.
git checkout branch Name
Ex: git checkout Demo
Create and switch Branch
git checkout -b branchName
Ex: git checkout -b Demo
Discord changes
git checkout --test.txt
Merge
You can merge two branches with the help of git merge command.
git merge
Ex: git merge branch Name
Merge into other branch
git merge source branch target branch
Ex: git merge Demo1 Demo
Cherry-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 1dsfe345
Rebase
Rebasing is a process to re apply commits on top of another base commit.
git rebase
Ex: git rebase Demo
Continue to apply changes
git rebase --continue
Skip changes and apply
git rebase --skip
Stash
Switch branches without committing the current branch.
git stash
Save Stash
git stash save “Msg”
List Stash
git stash list
Apply Stash
git stash apply stash ID
Ex: git stash apply 1dsfe345
Show Changes
git stash show or git stash show -p
Last updated