![]() |
#1 |
NPPAngband Maintainer
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
![]() |
Github help
This should be a simple task, but I can't make it work.
I just finalized NPP 0.5.3, and uploaded to the npp branch called work_in_progress. I want to push the changes to the branch called master. But I am not having any success, and I have this uneasy feeling the solution is so simple that the help files don't even bother to cover it. What should I be doing to simply make everything in the current work_in_progress branch push to the master branch? The link is here: https://github.com/nppangband/NPPAng...rk_in_progress Thanks for any help or suggestions you can offer. |
![]() |
![]() |
![]() |
#2 |
Prophet
Join Date: Aug 2009
Location: Madison, Wisconsin, US
Posts: 3,025
![]() |
I'm pretty much a novice at git but maybe this will work.
git push origin work_in_progress:master |
![]() |
![]() |
![]() |
#3 |
NPPAngband Maintainer
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
![]() |
I think the proplem is that, on my computer the branch is called Master, and on github it is called master (no caps). They aren't recognized as the same branch. I think I first need to pull "master" from github to my computer, then make the changes & push back.
Edit: It worked, sort of. The work_in_progress branch had about a dozen commits in between 0.5.2 and 0.5.3, and the master branch now has taken all of the updates and has the final 0.5.3. But the master branch took each commit individually. What I was hoping to do in the master branch was to have a single commit showing all of the differences between 0.5.2 and 0.5.3. Or is that just not how github works? Last edited by nppangband; September 17, 2011 at 09:04. |
![]() |
![]() |
![]() |
#4 | |
Angband Devteam member
|
Quote:
The alternative is to use git merge. This will also default to fast-forward, but if it can't fast-forward it will merge and produce a summary commit, called the merge commit. IIUC this is what you want - I've never forced this to happen in preference to a fast-forward, but with git anything is possible. According to git help merge, you need to use the --no-ff option. So I think what you want to do is git checkout Master git merge --no-ff work_in_progress git push origin Master:master Please note that the merge commit is merely a summary: it does not replace the individual commits - they will be shown separately in the log. You can get rid of them by generating a huge patch (git diff commit1 commit2 >../052-to-053.patch) and then applying it as a single commit to your master branch. Not sure why you'd want to do that though, but it shouldn't take long. EDIT: in case it's not clear, commit1 is the head of your master branch and commit2 is the head of your work_in_progress branch, and you need to generate the diff from the wip branch.
__________________
"Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles |
|
![]() |
![]() |
![]() |
#5 | |
Angband Devteam member
Join Date: Aug 2008
Location: Philadelphia, PA, USA
Age: 43
Posts: 1,517
![]() |
Quote:
That said, you can combine commits if you want. The general way to do this is to use rebase. Once you've used git a little bit more and gotten more comfortable with it I can try to explain how this is done. But since it modifies your commits, you can lose work if you aren't careful, so I will hold off for now. |
|
![]() |
![]() |
![]() |
#6 | |
NPPAngband Maintainer
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
![]() |
Quote:
My main thinking behind having only commit for each final release is that most of my commits contain bugs that are fixed later, so the good, working code that makes a useful patch are spread out over several commits. But of course, I can always just run a diff between different commits for that. And if I am really stuck on the idea of having one commit per version, I should just open up a second repository. Thanks again for the help. |
|
![]() |
![]() |
![]() |
#7 | |
Angband Devteam member
Join Date: Aug 2008
Location: Philadelphia, PA, USA
Age: 43
Posts: 1,517
![]() |
Quote:
Hope getting up to speed with Git isn't too painful, and welcome to Github! ![]() |
|
![]() |
![]() |
![]() |
#8 | |
Angband Devteam member
|
Quote:
Rebase is a special form of merge btw. It doesn't set out to squash commits together - if all the work can be fast-forwarded onto the new base, it will be. It's just that it usually can't, and a merge commit results. (In such a case, conflicting individual commits are *not* replicated separately from the merge commit.) If you're thinking "but what if I want my original commit and its bugfix commit, without all the stuff in between", then you need git cherry-pick. This takes just the commit(s) you specify, and applies them to your current branch. So you can cherry pick the commit you want, and any bugfix commit(s) for it, all neatly in your master branch. This is one reason that small atomic commits are good: you can't cherry pick a commit if it does more than just the thing you want.
__________________
"Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles |
|
![]() |
![]() |
![]() |
#9 |
NPPAngband Maintainer
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
![]() |
|
![]() |
![]() |
![]() |
#10 | |
Veteran
Join Date: Jun 2007
Posts: 1,393
![]() |
Quote:
@d_m: Though rebase will let you drop commits (thus losing history), you can always get back to where you started by using "git reflog" and doing a "git reset --hard ABCDE" where ABCDE is an appropriate entry from the reflog. |
|
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Getting Angband from Github and compiling it | Magnate | Development | 121 | December 17, 2019 04:57 |