git commit push merge, only I have problems?

Asked

Viewed 1,090 times

1

Good afternoon guys, whenever I’m working with git with more than one developer, using those branch creation features, commit and merge in master have problems precisely in merge? It happens that other people have merged before you, then conflicts arise and you start a step by step from suffocation with trials and failures that never solve the merge, after a suffering decided to take each of the changes, leave only one branch, delete the others, and stay comitando os merges one by one in master..

Anyway, it’s obvious that I’m a terrible git user, but it’s only me that suffers?

Was svn no longer cool because things(merge) didn’t promise to be automated like in git?

The SVN only gave conflict if the same line was changed, so I had to take the trouble to choose which change I wanted, anyway. In Git change a comma in the conflict file and I have to suffer to merge, using eclipse so it doesn’t even speak because the folder target that has the classes keeps giving difference, and ignore does not respect me as I would like.

This vent is to find out if other people have this kind of problem with git and how they did to improve the way they work with git.

  • Probably not, but there’s also probably a way to do it better. From what you’re saying, it sounds like you believe Git does magic. Have you ever thought about going back to working with SVN? And then who knows how to take it one step at a time? Git really is for a lot less conflict than SVN. But it can’t make a complete mess. If there’s more conflict going on in simple things, something very wrong is happening. And there’s no way you can help just by reporting it. I’m going to guess that they’re using Git the wrong way, but there’s no way to state or say what, no details. There’s no way around it.

  • about which you spoke, the colleague in the comment below complements with the example, we are using in a way that complicates life even.

1 answer

4


As @Maniero said, the idea is that with Git there are fewer conflicts with SVN.

Maybe the problem is the workflow they’re using. So I’m going to try to share here what workflow I’ve been using when I’m working with git.

My first rule: never work at branch master.

Second rule: If you have more than one developer, no one pushes directly to branch master. I always have a second branch (develop) where everyone does pull requests.

In other words, the developer/programmer works on a new branch inherited from develop:

$ git checkout -b minha_nova_functionality develop

Once the functionality is completed, the developer makes the pull request to the branch develop. The project manager reviews the code and if everything is up to code, accepts the PR and does the merge.

When the time comes to release the new version from what was done on branch develop, the manager creates a new branch to that end:

$ git checkout -b release-1.2 develop

In this new branch the manager can make some changes such as changing the version number, updating the file changelog or README.

At this point the manager can do the merge (all tests done) of the new branch for master:

$ git checkout master
$ git merge --no-ff release-1.2
$ git tag -a v1.2 $ git push origin master

And do the same merge to the branch develop

$ git checkout develop
$ git merge --no-ff release-1.2
$ git push origin develop

... And so on and so forth

With this, I avoid conflict problems, or that another dev commits a blur when editing a file that should not be edited.

It is important that each team member works on a specific solution, thus preventing the other dev from editing the same file. For cases where you need to edit the same file, as long as it’s not the same line, Git is smart enough to do the merge automatic.

  • I’ll organize the branchs here and try to do it that way, it looks good. thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.