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

How to have HEAD of git on two different branches at once

I hope the title doesn’t confuse too much, I’ll try to explain the issue I’m having in more detail here:

Suppose you have a repository with a code file (e.g. "main.py") and a setup file (e.g. "setup.env"). Now, the code is universal for everyone working on the repository, but the setup is specific to every contributor. For this example lets say ignoring the setup file and moving the setup in a separate submodule is not an option.

If we now make two branches called "feat-code" and "feat-setup" for the universal and personal changes each, is it possible to have the current HEAD on both branches at once? This would effectively merge both histories, without actually merging and creating a commit.

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 :

You can’t do that at once, however you can have separate git repository for personal setup. Personally I wouldn’t recommend that.

Usually when setup is stored in git repo, it is template, which has to be changed individually. They are added to .gitignore file, so don’t worry about changes. If you create new, remember to add it to .gitignore before personalizing it.

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