To create a branch and switch to it at the same time, run the
git checkout
command with the -b
switch:git checkout -b <branch_name>
Same as:
git branch <branch_name>
git checkout <branch_name>
To check the current status of the branch.
git status
To add the changes - from the root directory - will make all red into green, if you are using git-shell
git add .
To commit your changes - use "-m" - to add message
git add -m "committing for the first time"
To do a git push into your branch
git push origin HEAD:branch_name
To rename a branch
If you want to rename a branch while pointed to any branch, then use:
git branch -m <oldbranch> <newbranch>
If you want to rename the current branch, you can do:
git branch -m <newbranch>
To delete a branch
deletes the branch locally, use -D to force delete.
To delete it form remote:git branch -d <brnach_name>
git push origin --delete <branchName>