Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Git best practice

Hi I’m new to Git and wondering how I should approach the following scenario.

I have a development branch which im working on new features, then I realise my live app has a bug. I fix the bug on master. I now want/need the bugfix on the development branch.

How should I deal with this? Do I go to the development branch and merge master?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

This is one of many scenarios where git really shines.

All you have to do is pull master into your development branch by checking out the feature branch and issuing a

git pull origin master

If the development branch conflicts with main because the bugfix changes the same lines as the development branch, you may prefer to rebase your branch on top of master.

git rebase -i origin/master

This re-applies your changes as if they were done after changes currently on master and can make for a cleaner merge in some cases.

You can safely experiment with both of these commands by branching off your development branch into a throw-away test branch, then using git diff to compare your throw-away branch with your development branch.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading