Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old September 26, 2012, 04:05   #1
nppangband
NPPAngband Maintainer
 
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
nppangband is on a distinguished road
github question

So far I have only used Git in its simplest form, merely to upload code that is ready for others to play. I have two branches for NPP. I upload every commit to a branch called "work in progress". When I am ready to finalize a version, I move everything from "work in progress" into "master", and I tag that commit as the final version.

The good news is, for the first time in about 5 years, RL is finally allowing both Diego and I to actively develop NPP at the same time. What we used to do is just send patches or files back and forth and one of us would manually merge them.

I guess this question is for the Angband dev team, but what do you all think is the best way for us to use github? I still want the work-in-progress branch to be the latest code that is ready for people to play, but what do you all think is the best way for both of us to get it there? Should we each just have separate branches, and just pull/fetch, merge and push each other's code into work_in_progress?

Thanks for any advice you all may have. I figure if the Angband devteam all has 6+ people all pushing things to the same branch at the same time, that you all would probably have some good advice on how Diego and I can best do things.
__________________
NPPAngband current home page: http://nppangband.bitshepherd.net/
Source code repository:
https://github.com/nppangband/NPPAngband_QT
Downloads:
https://app.box.com/s/1x7k65ghsmc31usmj329pb8415n1ux57
nppangband is offline   Reply With Quote
Old September 26, 2012, 04:55   #2
debo
Veteran
 
debo's Avatar
 
Join Date: Oct 2011
Location: Toronto, Canada
Posts: 2,344
debo is on a distinguished road
I would probably leave your remote repo set up the way it is currently, with 'master' and 'work_in_progress' as the remote branches.

Locally, you can treat 'work_in_progress' as your "release master". If you need to do something disruptive in 'work_in_progress', you can just create a local branch (it could be remote too, but not necessary) to make multiple commits to, merge that back into 'work_in_progress' when you're done, git pull origin work_in_progress to pick up Diego's changes, and voila, you can push.

Then, when it's release time, you can merge the work_in_progress branch back into master, just as you've been doing now.

git branch -d <branch> will delete the ref for a local branch when you're done with it.

git is awesome -- I hope you enjoy working with it as much as I have A 2-person team isn't really that much different than a 1-person team, tbh. The only weird thing you have to get used to is using 'git add' and 'git rm' to confirm that files really should be added/removed when pulling down someone else's changes.
debo is offline   Reply With Quote
Old September 26, 2012, 05:23   #3
fizzix
Prophet
 
Join Date: Aug 2009
Location: Madison, Wisconsin, US
Posts: 3,001
fizzix is on a distinguished road
Here's the approach that I use. I think other devs use something similar, or at least Magnate does.

It assumes that you have an official branch, something like npp/npp and a personal branch jeff/npp. I'll also assume that your official branch is named something like npp_master

Code adding side.
  1. git fetch official {get the latest version}
  2. git checkout -b new_stuff official/npp_master {make a new branch named new_stuff that starts on official master}
  3. (make changes)
  4. git add <changed_files>.c
  5. git commit {commit all the changes to your new_stuff branch}
  6. git push -f origin new_stuff {push the branch new_stuff to github}
  7. {submit pull request into official master from github}

Now let's say that Diego made some changes and submitted a pull request and you want to look at these changes and incorporate them into npp_master if everything looks ok. I assume you have a remote branch set up to track Diego (if you don't it's really easy to set it up.) Here's how I've been instructed to do this.
  1. git fetch diego {get the latest changes in Diego's branch}
  2. git checkout -b npp_master official/npp_master {make a local copy of the master branch, if you have a local copy that you keep in sync with npp_master you can use that, just don't include the -b}
  3. git cherry-pick -x <commit number for Diego's stuff> {add the commit to your local branch, the -x keeps track of where it's from}
  4. (compile and test, assuming everything looks fine)
  5. git push official npp_master {update the official npp_master branch}

Things get a little tricky if you both are simultaneously pushing stuff that mess around with the same files. But there are ways around that with either fixing the merge conflicts that arise with git cherry-pick or rebasing your changes, and fixing the conflicts, right before you push and submit the pull request.

There is something nice about having someone else test your changes to make sure that everything works fine, especially if you guys compile and run on different operating systems.
fizzix is offline   Reply With Quote
Old September 26, 2012, 08:27   #4
LostTemplar
Knight
 
Join Date: Aug 2009
Posts: 670
LostTemplar is on a distinguished road
Btw is using cherry pick command the best way to pull changes ? I use it, but it seems like a hack to me.
LostTemplar is offline   Reply With Quote
Old September 26, 2012, 10:52   #5
Magnate
Angband Devteam member
 
Join Date: May 2007
Location: London, UK
Posts: 5,057
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate
Quote:
Originally Posted by LostTemplar View Post
Btw is using cherry pick command the best way to pull changes ? I use it, but it seems like a hack to me.
It's useful for when you want some commits but not others, as "merge" is an all-or-nothing operation: you merge all the unmerged commits at once.

It's also useful for keeping things tidy, as merging will create a separate "merge commit" for each merge. This is fine if I'm pulling in half a dozen commits from Blubaron, but for single-commit fixes from other devs it's unnecessary cruft in the history, so I cherry-pick those instead.

@jeff: what fizzix said. This is written up at http://trac.rephial.org/wiki/GitUsage but pls say if we could make those pages more useful. Your WIP branch is what we used to call "staging" - we've actually done away with that, but it's definitely a valid approach. This means you and Diego should merge pull requests into WIP first, in case you need to change anything. You can stick with your system of pushing to master at intervals for 'official' releases.
__________________
"3.4 is much better than 3.1, 3.2 or 3.3. It still is easier than 3.0.9, but it is more convenient to play without being ridiculously easy, so it is my new favorite of the versions." - Timo Pietila
Magnate is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting Angband from Github and compiling it Magnate Development 114 December 17, 2016 23:58
Github for Windows Nick Development 0 May 30, 2012 06:25
Github help nppangband Development 9 September 20, 2011 22:11


All times are GMT +1. The time now is 02:19.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.