FreeOrion

Forums for the FreeOrion project
It is currently Thu Nov 23, 2017 5:19 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Thu Feb 04, 2016 11:46 pm 
Offline
Dyson Forest
User avatar

Joined: Wed Aug 13, 2014 7:21 pm
Posts: 208
Location: France
I installed GitHub Desktop because the Web interface (which I exclusively used) lacks two features:

- I can't update my FO fork (in order to be synced with FO main repo)
- I can't add images into my fork (only text files) in order to create a PR.

As I'm very bad with command lines, I thought that GitHub Desktop would be the solution... But there's something I totally don't understand concerning the Sync feature.

I clone my fork of Freeorion project.

So I have:

- my local repo ("master")
- the "remote" repo (my fork on GitHub)
- the upstream repo (freeorion/freeorion) automatically linked.

I can update my local repo from the upstream repo. That's OK, the two repositories are synced.

But after that, if I want to sync my local repo and the remote repo (so my fork will be identical to my local repo), it creates automatically a new commit (both on my local repo and on my fork) for the merge (.

So, both my local repo and my fork are one commit ahead the Freeorion main repo. And if I want to make a new PR, it contains this useless commit too.

Is it not possible to update the fork from the local repo, like the local repo is updated from the FO main repo?

Thanks.

_________________
I release every updated file under the CC-BY-SA 3.0 license.


Top
 Profile  
 
PostPosted: Fri Feb 05, 2016 12:16 am 
Offline
Creative Contributor
User avatar

Joined: Fri Jun 28, 2013 11:45 pm
Posts: 3264
It is, but for some reason the command needed isn't there as a basic feature in most of the GUIs.

Assumption: you're using Windows and you're using the GitGUI client (which is what I use(d) on Windows).

You can add commands to the menu, I forget which menu option it is (because I'm on Linux with different software) but I think it was one of the furthest right menus on the topbar, and the command you need is "git rebase master", this will rebase your clone from the master branch and then put your work at the top.

It's possible this might not work, you need to tell it that 'master' is the name of the main repo, or simply store 'git rebase https://github.com/freeorion/freeorion'. If it's not updating properly, then 'git fetch master' or 'git fetch https://github.com/freeorion/freeorion' should work, then rebase again.

Once you've stored it in as a command it should then be possible to do it multiple times without retyping it.

I was also terrible with command line, but I learnt as many git commands as I could because I'm switching systems fairly regularly and remembering a few words to type is easier than leaning completely different buttons to press in radically different GUIs, especially when some of the commands aren't there, despite them being obvious ones.

I hope that helps.

(we don't like using git pull because of all the extra commits it creates, plus it then puts your work amongst other commits which makes it harder to spot new stuff in trunk)

_________________
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.


Top
 Profile  
 
PostPosted: Fri Feb 05, 2016 2:37 am 
Offline
Dyson Forest
User avatar

Joined: Wed Aug 13, 2014 7:21 pm
Posts: 208
Location: France
Thanks for the answer.

After having read your post numerous times (something like 20 times ^^), I think I begin to understand.

In GitHub Desktop, I can open the command console by right-clicking on the local repo name ("Open in Git Shell"), then I can add commands lines (like "git remote -v" in order to know what are the names and url of each repository), if it's that you mean by "adding commands to the menu".

To be short:

I fetch changes from freeorion/freeorion (upstream) and merge those changes into my local repo ("master"), so the two repositories are synced.
> In GitHub Desktop, it just requires to click on "Update from [freeorion]/freeorion/master" button. Local and Upstream are now synced (timeline graphics are on par).

Then I want to push those changes to my fork on GitHub.com ("git push origin master" ?)
> In GitHub Desktop, it just requires to click on "Sync" button (if I understand well).

But after that, instead of my fork being synced with my local repo and the upstream repo, my fork master branch is 1 commit ahead freeorion:master, whereas it should display "This branch is even with freeorion:master".

Maybe I'm doing something wrong, or I miss something... Whatever, I will come back tomorrow with some annotated screenshots to better explain. :oops:

Thanks again.

_________________
I release every updated file under the CC-BY-SA 3.0 license.


Top
 Profile  
 
PostPosted: Fri Feb 05, 2016 3:37 am 
Offline
Dyson Forest
User avatar

Joined: Wed Aug 13, 2014 7:21 pm
Posts: 208
Location: France
Phew, finally did it, and finally understood all you were saying in your post. :D

The problem came from I thought that the "Update from freeorion/master" button in GitHub Desktop did a "fetch" then a "merge" in my local repo, but like you said, it did a "pull", creating an extra commit, which was pushed to the origin repo (my fork on Github) afterwards.

When I open GitHub Desktop, the "fetch" command is automatically done, I just have to do "git merge freeorion/master" when I'm on my local repo ("master").

Then, if I click on the "Sync" button, the changes are sent correctly to my fork on GitHub. It seems to be equal to "git push origin master", I don't know, but whatever, it works now and my fork is synced without extra commits.

Note: when I do "git merge freeorion/master", there is a warning message: "refname freeorion/master is ambiguous". Is this normal?

Thanks again, you were right, once that's understood, it's not so complicated. :mrgreen:

_________________
I release every updated file under the CC-BY-SA 3.0 license.


Top
 Profile  
 
PostPosted: Fri Feb 05, 2016 8:13 am 
Offline
Programmer
User avatar

Joined: Fri Mar 01, 2013 9:52 am
Posts: 1040
Location: Germany
Ouaz wrote:
Note: when I do "git merge freeorion/master", there is a warning message: "refname freeorion/master is ambiguous". Is this normal?


No it isn't. A refname is a symbolic and human readable name to an actual commit, and can be a branch name, a tag, a branch on a remote, …. For example: if you happen to create a local branch called 'freeorion/master' (yes, branch names can contain slashes, in fact you can organize them in folders) and you happen to name the upstream repository remote 'freeorion' it would happen that there is a remote branch called 'freeorion/master' both would have the same name therefor would be ambiguous, because git doesn't know if you meant the local branch or the remote branch when executing an operation. If you know that wasn't intendent by you you can rename the ref by giving its canonical name. Just execute 'git show-ref' to see all available refs. You can delete it with 'git update-ref -d <canonical name>', where the canonical name is the path to the offending ref startings with 'refs/' or rename it with 'git branch -m <oldbranch name> <newbranch name>'.

_________________
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz


Top
 Profile  
 
PostPosted: Fri Feb 05, 2016 10:56 am 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12016
Location: Munich
I gave up on using Github for Windows due to issues such as this, and the general inability to control what it's doing in terms of pulling/fetching or pushing when clicking the sync button. Instead I've been using TortoiseGit, which lets me do most of what I need, though still with occasional mistakes / unintended results (mainly when trying to work with branches instead of committing directly to master always).


Top
 Profile  
 
PostPosted: Fri Feb 05, 2016 6:55 pm 
Offline
Release Manager, Design
User avatar

Joined: Wed Nov 16, 2011 12:56 pm
Posts: 4243
Location: Sol III
As Geoff said, GitHub Desktop is not a very good GUI for git. Apparently it has a lot of issues. The two GUIs I'm using and can recommend are SourceTree and SmartGit. IMO SourceTree is clearer and simpler to use, while SmartGit seems a bit more powerful (e.g. built-in conflict solver, which SourceTree lacks). Both are free for personal (non-commercial) use and available for Windows, Mac OSX and Linux.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group