Git: Best Practice with Large Project Development Flow

We are using Git for version control. I am working on a large project that could radically change the current codebase. The general idea is to split the project into smaller pieces and link them locally to Git. So it's easier to keep track of what's being updated in small chunks.

However, the problem is that some of the fundamental elements have not yet been finalized, this may change due to the integration with the legacy system. One of the main elements changes (eg API, naming), all dependencies also need to be changed. This makes me unable to commit any code. Since the registered changes may need to be changed again due to fundamental changes to the item. This way, I keep everything uncommitted and hand it over piece by piece as soon as the fundamental element is actually complete.

I don't think this is a good practice. I would like to commit small pieces when I am done changing each part. Don't wait until a big project is nearly complete and commit at that time. How should I improve my development process?

+3


source to share


1 answer


I recommend creating a new branch for your work. You can follow these steps.

git branch

      

The above command will give you a list of your current branches similar to this:

production
* master  
testing

      

The dot with a star next to it is the current branch you are using. Pay attention to this.

Now create a new branch (here I called it "development", you can call it whatever you want):



git branch development
git checkout development

      

Anything you commit or push from now on will go to the branch named development

. On a regular basis, you should run this command to make sure you are in sync with the branch everyone else is using (replace master

with the name you wrote down earlier):

git merge master 

      

When you're done with everything and want to add your code to the shared branch, do this:

git checkout master
git merge development

      

You are now in the original branch again and contains all the new code. You may end up with merge conflicts that you need to resolve at this point. Also, you can keep using the development branch forever instead of dumping back to the main one.

+2


source







All Articles