Latest Posts

Topic: Move Widelands to GitHub

GunChleoc
Avatar
Topic Opener
Joined: 2013-10-07, 15:56
Posts: 3317
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2019-09-14, 20:37

You clone only once. The command for checking out a branch is git checkout .... You can also create a shallow clone with will only grab the latest commit - it's documented in Gitprimer somewhere.

We still have to figure out the best way to use separate folders for separate branches to reduce compile time. There is a git worktree command for that, but I haven't tried it out yet. I want to finish the branch migration first, which will probably take 5 days in all.

Edited: 2019-09-14, 20:37

Busy indexing nil values

Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2552
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2019-09-14, 21:08

Thanks for your explanations Nordfriese face-smile.png

GunChleoc wrote:

You clone only once. The command for checking out a branch is git checkout .... You can also create a shallow clone with will only grab the latest commit - it's documented in Gitprimer somewhere.

Hm, not very helpful comment... sorry. I have looked into the wiki article and found a possible table row in Comparison with bazzar, but i am not sure about the 'branch name'. I guess its 'update-script' but trying

git checkout -b update-script

or

git checkout -b update-script https://github.com/gunchleoc/widelands.git

produces only errors.

Edited: 2019-09-14, 21:08

Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2745
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2019-09-14, 21:09

GunChleoc wrote:

I can also imagine the following workflow:

  • Nordfriese and hessenfarmer are working together on widelands/amazons

Don't count on me anytime soon. I still struggle in understanding the workflow in git. And I don't know when I have time and motivation to read me through all the documentation. So for the moment being I am more the less out. Thanks for all your support the last years.

  • Nordfriese uses a branch in his own fork (nordfrees/amazons) to work on C++ changes
  • Nordfriese will make a Pull request from nordfrees/amazons into widelands/amazons (not widelands/master) to update widelands/amazons
  • We do a code review on the pull request and squash the commits while merging, ending up in 1 new commit in widelands/amazons

Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 2057
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2019-09-14, 22:12

kaputtnik wrote:

Thanks for your explanations Nordfriese face-smile.png

You´re welcome face-smile.png

GunChleoc wrote:

You clone only once. The command for checking out a branch is git checkout .... You can also create a shallow clone with will only grab the latest commit - it's documented in Gitprimer somewhere.

Hm, not very helpful comment... sorry. I have looked into the wiki article and found a possible table row in Comparison with bazzar, but i am not sure about the 'branch name'. I guess its 'update-script' but trying

git checkout -b update-script

or

git checkout -b update-script https://github.com/gunchleoc/widelands.git

produces only errors.

Can´t try this out myself because my development machine is having network problems, but you could try git fetch https://github.com/gunchleoc/widelands.git update-script. If that also doesn´t work, you might have to (time-intensively) clone the whole fork (git clone https://github.com/gunchleoc/widelands.git; cd widelands; checkout update-script)


Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 2057
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2019-09-14, 22:23

hessenfarmer wrote:

GunChleoc wrote:

I can also imagine the following workflow:

  • Nordfriese and hessenfarmer are working together on widelands/amazons

Don't count on me anytime soon. I still struggle in understanding the workflow in git. And I don't know when I have time and motivation to read me through all the documentation. So for the moment being I am more the less out. Thanks for all your support the last years.

Step 1: Please forget about all the git documentation. git is a powerful tool with a thousand ways of usage, and we need only about 1% of its functionality. It is possible to use git almost like bzr for our purposes:

  • To clone master (needed only once): git clone https://github.com/widelands/widelands.git

  • To keep in sync with the official version: git pull

  • To download a branch from github: Manually copy master, then do git checkout --track origin/<BRANCHNAME> in the copy

  • To commit: git add; git commit -m "message"; git push

This should be about all you need to get started...

Edited: 2019-09-14, 22:24

Top Quote
GunChleoc
Avatar
Topic Opener
Joined: 2013-10-07, 15:56
Posts: 3317
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2019-09-14, 23:11

Hessenfarmer, please don't give up that easily face-sad.png

Since you're on Windows, I recommend that you install Tortoise Git https://tortoisegit.org/. This is a lot easier to learn than using the command line, and then I can help you from there. The reason that we only have instructions for the command line so far is that there are so many different Git GUI clients.

Kaputtnik, try this:

$ git clone https://github.com/widelands/widelands.git --depth 1
$ cd widelands/
$ git remote add gunchleoc https://github.com/gunchleoc/widelands.git
$ git fetch gunchleoc --depth 1
$ git checkout update-script 

The last message you see should be:

Branch 'update-script' set up to track remote branch 'update-script' from 'gunchleoc'.
Switched to a new branch 'update-script'

And this is what the commands mean:

$ git clone https://github.com/widelands/widelands.git --depth 1
$ cd widelands/

Clone the main Widelands repository and change into its directory. You only need to do this if you haven't already. --depth 1 means you only fetch the latest revision, which will speed things up.

$ git remote add gunchleoc https://github.com/gunchleoc/widelands.git

Register my fork and call it "gunchleoc"

$ git fetch gunchleoc --depth 1

Register what's in my fork. Again, --depth 1 will speed things up. Git should tell you about the branches that it has found at this point.

$ git checkout update-script 

Switch to the branch.


Busy indexing nil values

Top Quote
GunChleoc
Avatar
Topic Opener
Joined: 2013-10-07, 15:56
Posts: 3317
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2019-09-14, 23:17

BTW GitHub also has good documentation for beginners: https://guides.github.com/

And some guides for TortoiseGit:

Edited: 2019-09-14, 23:22

Busy indexing nil values

Top Quote
Hasi50
Avatar
Joined: 2015-12-28, 16:19
Posts: 182
OS: MacOS
Version: 1.2 (selfcompiled master etc)
Ranking
Widelands-Forum-Junkie
Location: DE - near Frankfurt
Posted at: 2019-09-15, 08:38

Gun: working with remotes like you explained above is the way to go.

git remote add gunchleoc https://github.com/gunchleoc/widelands.git is the way to go so we do not have to clone the main repo more then once.

Then we should use git worktree to create local source / working directories.

The basic Atomic-Object for git is a commit-set (indendified by its hash). It is possible to have an inifinite number of repostiories and move around commit-sets between them.

Linux (some git named Linus actually invented it face-smile.png ) uses a hierarchical aproach: subsystem maintainers collect change-sets an commit them to a master. From there the version branches are forked. Version maintainers cherry pick (security-)changes into the stable branches. We are not as big as the Linux Kernel but we could go a similar way.

The only thing I must check now If I can commit to someone elses personal repo/branch I will try this now with gunchleocs update-script.

ssh works interchangeable with http checkout I will add this to the Primer


Here are the widelands where people may dwell, walking around care that evrythings well.

Top Quote
GunChleoc
Avatar
Topic Opener
Joined: 2013-10-07, 15:56
Posts: 3317
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2019-09-15, 09:49

You can commit just fine, but you won't be able to push to my fork unless I give you GitHub permissions for it. You could push into a new branch at the widelands repo, but tha would becomeconfusing very fast.

In the long run, it might be easier if most of us work on the official widelands repo, just like we used to do with the widelands-dev branch owner on Launchpad.


Busy indexing nil values

Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2552
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2019-09-15, 11:53

Thanks GunChleoc, that worked. Now i have one directory in which i change the branches with git checkout. This seems to me the main difference to bazaar, where you have each branch in its own directory, whereas with git you have only ONE directory (except the workflow described by Nordfriese). Is this true?

The thing with linking other documentation is fine, but i think we should at least provide a full working example. If a new developer want to propose a change of one line in a lua file and he has no experience with git, he won't do that (propose the line change) if he has to read a lot of documentation on different sites, imho.


Top Quote