Strange behavior of GitHub
Geert Janssens
geert.gnucash at kobaltwit.be
Mon Jul 31 12:29:29 EDT 2017
Frank,
I read the related conversation on IRC today and you raised the concern of creating too many
remotes in your local repository when applying pull requests from there.
Adding a remote only to apply a pull request is not really necessary and I never do it. Instead I
pull the branch from the PR directly into my local repo using "git pull". It takes some shuffling of
the information provided by the PR.
For example, if you get a PR against the gnucash repo with the following message (taken from
the real PR#163):
0-wiz-0 [1]wants to merge 2 commits into Gnucash:master from 0-wiz-0:master
I would locally run this command (with master being checked out and fully up to date with
master on code.gnucash.org):
git pull https://github.com/0-wiz-0/gnucash master
If master on code.gnucash.org has diverged from 0-wiz-0's master branch, this will trigger a
merge action, otherwise it would be a fast-forward.
Sidenote: I used to rebase non-fast-forward PR's to avoid the merge but have stopped doing so
for all but the most trivial PRs. By not rebasing github will properly detect the PR to be merged
after a rebase, one needs to manually close the PR on github. Also a rebase makes it harder for
the author of the PR to sync his local repo with our primary one after the PR is pulled.
Here is a breakdown of the relevant info in the PR message compared to the git pull command:
[github-user] wants to merge x commits into Gnucash:[target-branch] from [github-user]:
[source-branch]
There's an implicit bit of information as well, namely which [repo] the PR is targetting. Obviously
you should work in a local repo for the same source base as in github. So if the PR is against
gnucash-docs, you need to do the git-pull in your local gnucash-docs repo. I mention this,
because you need this bit of information in your git-pull command as well.
So the above translates into
* go to the proper local repo
* check out [target-branch] (master in the example, but can be maint as well for other PR's)
* make sure this branch is up to date with code.gnucash.org (using 'git pull' without any
arguments, assuming you don't have local, non-pushed work on your primary branches. You
don't, right?)
* then formulate the pull from another remote (from the [github-user]'s repo):
git pull https://github.com/[github-user]/[repo] [source-branch]
It's slightly more typing than clicking the fancy button on github, but avoids the need to make
each new repo in a PR a remote.
Regards,
Geert
PS: final note - this technique can be used to pull from any other repository (online or not) as
long as the git command can reach the other repository. So the repository URL can be a github
url (https://github.com/...), but equally a url to another online site that hosts repositories, or
even a file path to another repo on your own PC. For more info search the git help information
on repo urls.
On woensdag 26 juli 2017 23:28:01 CEST Frank H. Ellenberger wrote:
> Hi all,
>
> Dmitry watched, that his PRs disappeared from Maint after I merged them
> in Master.
>
> So, what happened?
> He sent PR 100-104 to github
> I pulled them via https://github.com/Gnucash/gnucash-docs/pull/...
> sequently into maint, after each calling locally:
> (with git checkout maint)
> git pull
> make
> make check
>
> He watched, they did not appear in code.gnucash.org/docs.
>
> I run yesterday locally
> git checkout master
> git merge maint
> make
> make check
> git push
>
> The guides in https://wiki.gnucash.org/docs/{de|ru}/ were regenerated
> last night, while *.{epub|mobi|pdf} are still from 2017-07-01. But that
> is a separate issue.
>
> Today Dmitry informs me, his commits disappeared from maint on github.
> On my machine I have now 21 unpushed commits in maint.
>
> I am clueless, but remember before the last release also one commit
> disappeared.
>
> Does anybody whant to investigate in the current state or can I push
> them now again?
>
> Regards
> Frank
>
>
>
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel
--------
[1] https://github.com/0-wiz-0
More information about the gnucash-devel
mailing list