Git Branches

Git branches helps the developers to work on the code simultaneously without being dependent on other teams , ether used to create features by different branches

  • This command is used to check the branch we are currently on

git branch
  • This command is used to rename the active branch to main

git branch -M main
  • This command is used to create a new branch

git checkout -b <branch name>
--------------- OR ----------------
git branch <branch name>
  • This command is used to delete the branch

git branch -d <branch name>
  • This command is used to switch between the branches

git checkout <branch name>
  • To check the difference between the branches

git diff main

Last updated