This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Contributing: question about workflow with git

Tags: None
(comma "," separated)
wotan
Registered Member
Posts
131
Karma
-2
OS
Hi all,

I am thinking to (try to) contribute to a KDE software. I know how to use git for a standalone repositories but I have never work on a project that is being actively worked on by several developper at the same time. Also I am having question about the actual workflow.
I gonna clone the git repo of the Software.
I gonna make my own branch on my standalone repo to develop my own feature.
Lets say that in develloping this, i have to modify a.cpp

Question is if in parrallel someonelse is also modifying a.cpp, how will we do to do the merge at the end?
Or is it better to push my modifications very often, even if they are not finished?
User avatar
scummos
Global Moderator
Posts
1175
Karma
7
OS
Just by cloning the repository, you already make your own branch, technically.

If you want to work on a feature which you want to share with others while developing, for example because they might want to contribute to it or review your work, you can have a "feature" branch (i.e. not master or one of the release branches) and push it whenever you commit (or after a few commits). When the feature is considered ready, you can just merge that branch to master (git checkout master; git merge mybranch). Git will try to merge the changes automatically, and if something goes wrong somewhere it will tell you and you have to resolve the conflict by hand.

If your change is smaller, you can just do your commits to the master branch, and pull changes from the remote with "git pull --rebase". This, too, will automatically merge your changes to what changed upstream and prompt you if there's a conflict.

Is that what you wanted to know?

Cheers,
Sven


I'm working on the KDevelop IDE.
wotan
Registered Member
Posts
131
Karma
-2
OS
Yes that was the question indeed.

But I mean if you developp a feature on your own branch, it might be possible that someone else is also modifying the same part of the code, or modifying functions/classes that you are using, wich make your code not up to date when you want to merge it.

But I guess issues like that can only be solved by hand
User avatar
scummos
Global Moderator
Posts
1175
Karma
7
OS
As said, just run git merge, it will merge the parts which don't conflict and then give you a list of conflicts you have to resolve manually. It will put conflict markers into the files where there's a conflict, and you got to go there and sort it out with your text editor, then tell git you resolved the conflict by calling "git add". Git tells you everything, so it's trivial to do.

Greetings,
Sven


I'm working on the KDevelop IDE.
User avatar
google01103
Manager
Posts
6668
Karma
25
moved to KDE Development -> helping hands


OpenSuse Leap 42.1 x64, Plasma 5.x



Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]