Some Git Fundamentals You Should Know

İbrahim Gündüz
Developer Space
Published in
2 min readFeb 17, 2018

Always we face some sort of confusions like the following among the developers about git. So I want to summarize and clarify something about daily GIT issues.

You shouldn’t merge master branch with the feature branches

Yep. You shouldn’t. You should rebase the feature branches by master if you need to get the changes into your feature branch.

You shouldn’t use pull to getting changes from remote copy of feature branch, while working someone together

Because pull means: git fetch + git merge. So it will merge the new changes with local copy chronological. In this way, it will bring commit sequence difference between developers, diverged branches, too much conflicts, also code losses.

So we should use rebase (or pull — rebase) to keep commit history while updating feature branches by remote copy.

Don’t need to use fetch before pull

Pull is a shortcut command that provide by GIT. It’s equivalent of:

git fetch + git merge 

So you don’t need to use extra fetch before called pull command.

Also you can change, the changes application method as rebase instead of merge either using — rebase parameter or changing related git configuration.

Don’t get updates from any pipeline branches to feature branches.

If your have a bit complex version control flow, and you have to use some pipeline branches to deploy changes to pre-prod environments, you shouldn’t get updates from pipeline branches except master. Because pipeline branches might be contains unstable changes and it messed up your production environment. Feature branches should be ready to deploy always and shouldn’t contains any other changes except needs.

--

--