Avatar billede fredand Forsker
23. oktober 2019 - 13:46 Der er 1 kommentar og
1 løsning

Why use fork in GIT?

Hello guys,

We use GIT alot, but I might think we might not use it in the best practice way, since we do not use fork.

We use it like this:
1) clone our repo and set up the dev-environment, this is just done once.
2) When we start on a new issue we do git pull from master
3) create a branch for the issue
4) do the developing
4a) if the developing take a long time we might do a git pull in master and merge it to the developing branch, just to keep up with other developers work.
5) When done developing, we do a git pull in master and merge it to the developing branch (take care of merge-problems in developing branch)
6) Create a pull request from developing branch to the master
7) Merge from our build-server

I new team member told us that it is better to use fork but he could not explain why it would be better.
How ever it looks like the process with fork is:

When we start on a new issue we do
1) fork the repo (with autosync on), and set up dev-environment, this is done every time.
3) create a branch for the issue
4) do the developing
4a) if the developing take a long time we might do a merge from master (it should be autosynched) to the developing branch, just to keep up with other developers work.
5) When done developing, we merge master to the developing branch
6) Create a pull request from developing branch to the master
7) Merge from our build-server

If the later is the best practice I frankly do not see any advantages.
The later also seems to be more time consuming if the set up of the dev-environment is complex.
Do you guys see any missunderstandings?

Best regards
Fredrik
Avatar billede arne_v Ekspert
23. oktober 2019 - 16:42 #1
This question is not really Java specific.

It is many years since I stopped being a source control guru.

But links like these talk about the topic:

http://bryanpendleton.blogspot.com/2014/07/git-clone-vs-fork.html

https://github.community/t5/Support-Protips/The-difference-between-forking-and-cloning-a-repository/ba-p/1372
Avatar billede fredand Forsker
24. oktober 2019 - 13:31 #2
Hello Arne
You are the Guru,

Thank's for the very interesting links especially the last one.

My conclusion is that if you only got a project with team members that work on the repo you would be satisfied with "clone".

But if you got a project with team members that work on the repo and also let other people outside the project create pull request then those outside the project need to use "fork".

Thats my conclusion
Feel free to comment
Best regards
/Fredrik
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester