Branching - biswajitsundara/gitdoc GitHub Wiki
1. Create a new branch
Let's create a new branch in local and push to remote.
- Make sure you are on the branch from where you want to cut the new branch
- Use the command
git branch
to check you are on which branch - Here the branch name is
feature1
- Usually the branch names have the naming convention:
yournameORId_ticketId_Desc
- For example a branch name:
bis_JIRA2020_customerInfo
git checkout -b feature1
git add --all
git commit -m "message"
git push -u origin feature1
2. Delete the branch
We need to have write access to delete a branch.
- Switch to another branch using the git checkout command
git checkout master
- Delete the local branch using the git branch command with the -d flag This will delete the feature-branch branch from your local repository.
git branch -d feature-branch
- Delete the remote branch using the git push command with the --delete or -d flag This will delete the feature-branch branch from the remote repository.
git push origin --delete feature-branch