FreeOrion

Forums for the FreeOrion project
It is currently Thu Oct 19, 2017 9:53 pm

All times are UTC




Post new topic Reply to topic  [ 188 posts ]  Go to page 1, 2, 3, 4, 5 ... 13  Next
Author Message
PostPosted: Wed Mar 25, 2015 11:11 am 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12003
Location: Munich
EDIT by Vezzra:
Split off from this thread.

Ok, questions and answers about how to use git and github begin to accumulate in several threads, so I decided to open this sticky thread as some means to collect all these posts here. I'm going to move postings that deal with this topic here, and invite everyone to continue related discussions here.

I could have used the thread Cjkjvfnby started for that, but I don't want to clutter it with various posts from various places, so I just put a link to his thread here: http://www.freeorion.org/forum/viewtopic.php?f=9&t=9363

One final word: Please, dear fellow devs, you really, really need to read up the basic git tutorials on the official git home page. Even if you (like me) are going to use a GUI git client, you need to understand the basic concepts and how git works. It's different from subversion, and it's important to understand these differences. You will spare yourself a lot of frustration.
/EDIT


I tried to create a branch, but I'm not sure if I did it correctly... It shows up as a branch in the freeorion account, but the master also seems to list the commits? Can anyone comment?

https://github.com/freeorion/freeorion/ ... port-Stuff
https://github.com/freeorion/freeorion/commits/master


Top
 Profile  
 
PostPosted: Wed Mar 25, 2015 12:40 pm 
Offline
AI Contributor
User avatar

Joined: Tue Jun 24, 2014 9:55 pm
Posts: 444
Geoff the Medio wrote:
I tried to create a branch, but I'm not sure if I did it correctly... It shows up as a branch in the freeorion account, but the master also seems to list the commits? Can anyone comment?

https://github.com/freeorion/freeorion/ ... port-Stuff
https://github.com/freeorion/freeorion/commits/master


How did you create branch? How did you push it?

Check .git/config in repo folder, after create branch and check again. upd. May be you push then you was in master?

Code:
git checkout master
git checkout -b test_branch
# make commit
git push -u origin test_branch

Check branches on github.
Do cleanup
Code:
git branch -d test_branch  # check output if branch was deleted
git push origin :test_branch  # pushing deleted branch on server will delete it from server

_________________
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0


Top
 Profile  
 
PostPosted: Wed Mar 25, 2015 1:57 pm 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12003
Location: Munich
Cjkjvfnby wrote:
How did you create branch? How did you push it?
Modified some files, right-clicked the FreeOrion folder and picked Git commit -> master. Picked some files, entered a log message. Repeated that a few times. Right clicked TortoiseGit -> Create Branch, specified a name, based on something (don't know what was picked). Then right clicked TortoiseGit -> Push..., picked some options (I have no idea, git is and the interface are ridiculously complicated) and clicked OK. Checked the github site, posted here.
Quote:
Check .git/config in repo folder, after create branch and check again.
Check for what?
Code:
[core]
   repositoryformatversion = 0
   filemode = false
   bare = false
   logallrefupdates = true
   symlinks = false
   ignorecase = true
   hideDotFiles = dotGitOnly
[remote "origin"]
   url = https://github.com/freeorion/freeorion
   fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
   remote = origin
   merge = refs/heads/master

I don't see anything about my branch in there, which might be part of the problem?

Quote:
upd. May be you push then you was in master?
Maybe? I thought making a branch would push to the branch by default... presumably I've picked some wrong option somewhere in there, though?

git command line suggestions is useless for me...


Top
 Profile  
 
PostPosted: Wed Mar 25, 2015 2:07 pm 
Offline
Space Squid

Joined: Sun Mar 24, 2013 3:56 pm
Posts: 85
Since you made the commits before you made the branch, they ended up being in master as well as the branch (the branch being based off of your latest master). You'd have to make the commits after the branch, or (assuming http://tortoisegit.googlecode.com/git/d ... Commit.png looks around the same as the dialog you ran into?) checked that box saying "new branch" and made sure it was always being committed into there.

_________________
All my code and content provided herein or on GitHub is released under the GPL 2.0 and/or CC-BY-SA 3.0, as appropriate.


Top
 Profile  
 
PostPosted: Wed Mar 25, 2015 2:46 pm 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12003
Location: Munich
wheals wrote:
Since you made the commits before you made the branch, they ended up being in master as well as the branch (the branch being based off of your latest master). You'd have to make the commits after the branch, or ... checked that box saying "new branch" and made sure it was always being committed into there.
That somewhat makes sense. So if one has already committed to master locally, there's no way to move those commits to a new branch before pushing to remove / origin repository?


Top
 Profile  
 
PostPosted: Wed Mar 25, 2015 2:55 pm 
Offline
Space Squid

Joined: Sun Mar 24, 2013 3:56 pm
Posts: 85
Opening the new branch, which will now have all the commits you had on master, would be the first step.

On the command line, my next step would be to switch back to the master branch and wipe it clean (git checkout master && git reset --hard origin/master). I'm not sure how to do this on TortoiseGit; apparently there's a Reset dialog (https://tortoisegit.org/docs/tortoisegi ... reset.html) but I'm not seeing how to get to it. Maybe it's under the "Clean up..." menu option?

_________________
All my code and content provided herein or on GitHub is released under the GPL 2.0 and/or CC-BY-SA 3.0, as appropriate.


Top
 Profile  
 
PostPosted: Wed Mar 25, 2015 3:10 pm 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12003
Location: Munich
Just made a new commit and push on the branch, and it appears to have only gone to the branch of the repository, as intended.


Top
 Profile  
 
PostPosted: Wed Mar 25, 2015 3:13 pm 
Offline
AI Contributor
User avatar

Joined: Tue Jun 24, 2014 9:55 pm
Posts: 444
May be visualization of commit tree will help you to get in touch with git faster? (gitk is installed along with msysgit)
https://lostechies.com/joshuaflanagan/2 ... stand-git/

_________________
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0


Top
 Profile  
 
PostPosted: Wed Mar 25, 2015 5:19 pm 
Offline
AI Lead, Programmer
User avatar

Joined: Sat Sep 22, 2012 6:25 pm
Posts: 4371
Geoff the Medio wrote:
git command line suggestions is useless for me...
You might not be used to working with the Windows command prompt, but it can be helpful sometimes. For SVN I found it most handy to work with a mixture of command line and gui. The basic install for TortoiseGit might not have put git into your system path, but I think that's easy enough to remedy. Here's a moderately recent post about setting up git and tortoisegit with command line ability; if you already did that setup this that page should point the way to using the git command line. If your setup was different and those steps don't work for you, then you could check your git executable location in tortoisesvn as shown on this tortoisegit help page, and then add that folder to your system path as discussed in this rather old post about tortoisegit.

If not using the special git-bash prompt as discussed in that first link, then for Windows 7 and earlier I get a standard command prompt from Start->Programs->Accessories (and then maybe another subfolder); this page has some instructions that are perhaps slightly more streamlined and includes instructions for Win8, plus good general info about the command line.

_________________
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0


Top
 Profile  
 
PostPosted: Wed Mar 25, 2015 9:25 pm 
Offline
Programmer

Joined: Sun Apr 06, 2014 4:15 pm
Posts: 255
To me TortoiseGIT embodies one of the greatest weaknesses of GUIs: To make the GUI able to do lots of things, you have to have lots of things in you face when you use the GUI. TortoiseGIT shows checkboxes for all the rarely needed and cryptic options of Git when you are trying to do the simple things. But it is a clone of TortoiseSVN so if you loved that, you may like TortoiseGit too.

The way I use Git is a combination of the command line, git gui and gitk. I cannot recommend git gui enough. It is a very simple tool that lets you do everything you need to create commits. It comes with all windows git installers I know of. You can launch it from the command line with "git gui". (From some installs it is also in the context menu of a git working copy). TortoiseGit needs piles and piles of complex dialogs and context menus for the basic uses cases git gui covers with a single window, because TortoiseGit tries to let you do everything.

The other gui tool I use is gitk. It too comes with git installers, you launch it with "gitk --all" . It lets you see existing commits in the branch DAG and check out and move branches. It is much like the SVN log.

For pushing, fetching and rebasing I use the command line, but TortoiseGit ot GitHub for windows are fine too, I suppose. I feel GitHub for windows has the Gnome syndrome, though. Aka. it tries to be too simple and look pretty to the detriment of actual usability.

On windows I make notepad++ my git editor. Make sure to specify at least -multiInst to make sure you get an independent window.
Code:
git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession"


BTW: An SVN update is semantically closer to a fetch+rebase than a pull. Understanding that may help SVN people grok the concepts.

_________________
Any code by me in this post is released under GPL 2.0 or later.


Top
 Profile  
 
PostPosted: Wed Mar 25, 2015 9:53 pm 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12003
Location: Munich
Mitten.O wrote:
To me TortoiseGIT embodies one of the greatest weaknesses of GUIs: To make the GUI able to do lots of things, you have to have lots of things in you face when you use the GUI. TortoiseGIT shows checkboxes for all the rarely needed and cryptic options of Git when you are trying to do the simple things. But it is a clone of TortoiseSVN so if you loved that, you may like TortoiseGit too.
That seems like a problem with poorly designed GUIs... there should be options, but they don't all need to be immediately visible. I'm certainly not liking TortoiseGit as much as TortoiseSVN; the latter has a dramatically simpler interface, and the former has dozens of droplists and buttons and check and lists on every dialog. Your comment gives me hope that perhaps it's partly due to the design of TortoiseGit that git is seeming to be so needlessly complicated to do anything.


Top
 Profile  
 
PostPosted: Wed Mar 25, 2015 10:29 pm 
Offline
Release Manager, Design
User avatar

Joined: Wed Nov 16, 2011 12:56 pm
Posts: 4226
Location: Sol III
Mitten.O wrote:
An SVN update is semantically closer to a fetch+rebase than a pull. Understanding that may help SVN people grok the concepts.
Yep, although, for that to really grasp you first need to familiarize yourself at least basically with what "fetch" and "rebase" is. Otherwise, well, you won't get past "huh?".


Top
 Profile  
 
PostPosted: Wed Mar 25, 2015 10:35 pm 
Offline
Release Manager, Design
User avatar

Joined: Wed Nov 16, 2011 12:56 pm
Posts: 4226
Location: Sol III
Geoff the Medio wrote:
Your comment gives me hope that perhaps it's partly due to the design of TortoiseGit that git is seeming to be so needlessly complicated to do anything.
Git is a bit confusing and seemingly complicated at first, the main problem really is to get past the initial confusion. I can only repeat over and over, dig through the tutorials. That helped me more than anything else to get started.

Once you get the hang of it, git is really nice and powerful IMO. I begin to understand why people who are used to it are having such a hard time if they have to put up with subversion... ;)


Top
 Profile  
 
PostPosted: Sun Mar 29, 2015 9:07 am 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12003
Location: Munich
Edit by Vezzra: This post is a reply to this one. Moved it and follow-up replies here.
adrian_broher wrote:
Geoff the Medio wrote:
What does having a tag mean if the branch containing the commit that was tagged is deleted...?
I don't understand your question, sorry.
You propose to delete the release branch, but then have a tag or link to a particular commit for a release. But if the release commit is on the release branch, which was deleted, how can you link to or refer to it, since the release commit (at least for v0.4.4) is not merged back to trunk, so only exists on the (deleted) branch?


Top
 Profile  
 
PostPosted: Sun Mar 29, 2015 9:12 am 
Offline
Release Manager, Design
User avatar

Joined: Wed Nov 16, 2011 12:56 pm
Posts: 4226
Location: Sol III
Geoff the Medio wrote:
What does having a tag mean if the branch containing the commit that was tagged is deleted...?
AFAIK deleting a branch in git just deletes the "branch marker" pointing to the latest commit of the branch. This doesn't change anything about the commit history. The tag won't be affected by deleting the branch, and still point to the same commit as before.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 188 posts ]  Go to page 1, 2, 3, 4, 5 ... 13  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


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