Skip to content

Tips to avoid git branches conflicts

Scrappers Team edited this page May 18, 2022 · 3 revisions
  1. Recall, you want to add 2 new features : -foo -baz, then follow these steps :
  • Create 2 branches from the master :
git checkout -b 'foo-feature' master
git checkout -b 'baz-feature' master
  • Now start by one of them, for example baz-feature.
  • Do your changes to baz-feature.
  • Add your changes using :
git add ./foo-folder
  • Commit your added directories.
git commit -m 'foo-message'
  • Now push onto foo-feature.
git push --set-uptstream https://github.com/Organization/REPO-NAME foo-feature
  • Then create a PR.
  • Repeat the same thing with baz-feature.
  1. Avoid this :
git checkout -b foo-feature
git checkout -b baz-feature

Because, this creates the new branches from the current ones, this will show conflicts if the parent branch has a changeable PR.

Clone this wiki locally