Python (Django) Classroom Series – 14/Aug/2021

Branches in Git

  • To Create a branch in Git
git branch <branch-name>
  • To move your working tree to point at the branch
git checkout <branch-name>

Preview

  • How is remote configured in your git repository?
    • Remote will have a name by default origin
    • navigate .git/config file to find out the remote server details
  • To push the branch to the remote
git push <name-of-remote> <name-of-branch>
git push origin v1.0
git push origin v1.1
  • If the changes done on one branch are to be required on other branch we perform merge
  • To perform merge execute the following command
git checkout main # checkout to the source
git merge v1.0
  • Now lets try to merge the changes from v1.1 to the main branch

  • Lets make two commits in the v1.1 Preview

  • Now lets assume the first change which we have done is required on v1.0 branch also

    • If you need specific commits to be added to branches we can use cherry-pick git cherry-pick <specific commit id> Preview
  • For rebase Refer Here

  • For merge Refer Here

  • For cherry pic Refer Here

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin