You and your colleagues will love you more.

If you are here, you know what you are doing, so let’s cut to the chase.

Never push broken code to main or master. Always use a branch to tweak and test your code.

Do you know how annoying it is to clone a repo and it fails to run on the first try? It is such a mood breaker. Some people keep pushing to master or the main branch even though they have not tested the code tweak properly. Don’t be those people.

You can create a branch from the master should you need to change the code. For example, name your branch john_tweak.

git branch john_tweak

Don’t forget to check out your newly created branch.

git checkout john_tweak

Now you can modify/add/commit your code however you want.

Once the code is done and properly tested, you can merge john_tweak with master branch. You will have some conflicts if the master branch is edited. Resolve them, and then you can push.

git checkout master
git merge john_tweak
git push origin master

#technology #programming #code #git

4 Git Pro Tips You Should Start Doing
1.30 GEEK