The Git/GitHub Questions, Answers and Howto Thread
Moderator: Committer
Re: The Git/GitHub Questions, Answers and Howto Thread
This is helpful, thanks. GitGUI names my local Repo "master" and I saw no reason to rename it, GitHub also names my fork "master" but I think that's because it's talking about the "master branch" as it copies all the other branches, I have the effects priority branch as well although I've never used it (I should do, but been busy).
Sometimes it won't let me send stuff to GitHub if my branch is out of date, hence I do a pull request before pushing just to get things up to date, I think the thing that baffles me still is why it tracks all the updates to/from main in the way it does, in SvN you just grabbed the most recent updates and it was fine, now if I update from main then do some work and send it back to main not only am I sending extraneous commits but my own repo is immediately out of date just because I've merged somethign from it into main, that seems daft. I'm guessing that makes a lot more sense for massive projects but, well, it's taking getting used to.
I need to setup local branches and learn to use them properly then, and then work out selective merging into new branches before pushing, I can do that.
Sometimes it won't let me send stuff to GitHub if my branch is out of date, hence I do a pull request before pushing just to get things up to date, I think the thing that baffles me still is why it tracks all the updates to/from main in the way it does, in SvN you just grabbed the most recent updates and it was fine, now if I update from main then do some work and send it back to main not only am I sending extraneous commits but my own repo is immediately out of date just because I've merged somethign from it into main, that seems daft. I'm guessing that makes a lot more sense for massive projects but, well, it's taking getting used to.
I need to setup local branches and learn to use them properly then, and then work out selective merging into new branches before pushing, I can do that.
Mat Bowles
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Re: The Git/GitHub Questions, Answers and Howto Thread
Resent GitHub post:
Improving the GitHub workflow for the Microsoft Community
Improving the GitHub workflow for the Microsoft Community
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0
Re: The Git/GitHub Questions, Answers and Howto Thread
Can I bollocks. Half an hour trying ti do the very simple thing of checking out a new copy of master and I've got nowhere at all.MatGB wrote: I need to setup local branches and learn to use them properly then, and then work out selective merging into new branches before pushing, I can do that.
All I want to do is upload some revisions to en.txt for this weeks test build. That's it. My copy of the repo has managed to create itself 43 commits "ahead" of master, most of which are already in master but it's decided to insist they be committed again because I rebased on my home machine.
I cannot figure out how to delete the repo on my machine, cannot figure out how to tell Github to delete my current fork and take a new copy, cannot figure out how to get a new clean branch onto my machine. Can't even simply merge what I've got as the rebasing has created 40+ completely pointless commit messages.
The attached is meant to be in master, would've been about an hour ago if I wasn't so utterly confused by such basic features. It's in mine already. All it is is an update to the current English stringtable based entirely around making Supply and Growth clearer.
If I want to just delete my fork on Github and start again, how do I do it?
- Attachments
-
- en.txt
- (382.31 KiB) Downloaded 132 times
Mat Bowles
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: The Git/GitHub Questions, Answers and Howto Thread
Go to the repository URL. At the right, below Pull Requests, Pulse, and Graphs, is Settings. Click settings. At the bottom of that page there is a "Danger Zone" which has a "Delete this repository" function.MatGB wrote:MatGB wrote:If I want to just delete my fork on Github and start again, how do I do it?
Re: The Git/GitHub Questions, Answers and Howto Thread
I've cherry picked that commit from your fork and pulled it into master.MatGB wrote:The attached is meant to be in master, would've been about an hour ago if I wasn't so utterly confused by such basic features. It's in mine already. All it is is an update to the current English stringtable based entirely around making Supply and Growth clearer.
Re: The Git/GitHub Questions, Answers and Howto Thread
Aha. OK, if I do that and then make a new copy, hopefully I can get somewhere.
Vezzra: How? How did you do that?
Vezzra: How? How did you do that?
Mat Bowles
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Re: The Git/GitHub Questions, Answers and Howto Thread
If you're not sure you've got everything committed into the main repo now, you might want to just rename it. Using GitHub for windows makes the thing a bit more tricky. I think the easiest thing to do will be to start by renaming your current github repo so you don't lose anything that you haven't yet gotten into master. I would start by closing GitHub for Windows, and then in a web browser go to your github settings for your fork, here: https://github.com/MatGB/freeorion/settings and then in the middle where it shows your repo name it lets you rename it there -- you could do something like freeorion_backup.MatGB wrote:If I want to just delete my fork on Github and start again, how do I do it?
Until you make a new freeorion repo on github, github will forward any MatGB/freeorion references to the renamed repo. You could see if your GitHub for Windows client realizes it is getting forwarded and updates itself to directly point to the new location, if not then it will probably be simplest to delete your local repo, either via GitHub for Windows if it lets you, or else via Windows Explorer or whatever.
Then you could go back to the web browser for GitHub, and just make a new fork from freeorion/freeorion, and you should be set.
To help prevent this kind of trouble in the future, Here is an article talking about deleting your forked master branch to avoid the trouble you're having now. The article assumes you can use git on the command line. If you have a decent local git gui client you could also do it through that. I highly suggest trying smartgit. If you do, when installing, be sure to tell it non-commercial rather than just 30-day-trial.
A decent git gui should make it extremely easy to do cherrypicking like Vezzra did-- you just checkout the branch you want the commit to go into, then in the visual log select the commit you want, and then either right-click or else just hit the cherrypick button if you have it showing.MatGB wrote:Vezzra: How? How did you do that?
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0
Re: The Git/GitHub Questions, Answers and Howto Thread
Pretty much that. Although, in this case, as I cherry picked from your fork, Mat (and not just a branch in the main repo), I had to add your fork as a remote to my local clone in order to access your master branch.Dilvish wrote:A decent git gui should make it extremely easy to do cherrypicking like Vezzra did-- you just checkout the branch you want the commit to go into, then in the visual log select the commit you want, and then either right-click or else just hit the cherrypick button if you have it showing.MatGB wrote:Vezzra: How? How did you do that?
That's a quite brief explanation - does that clear it up for you, or do you need more details for certain steps?
Re: The Git/GitHub Questions, Answers and Howto Thread
Ah, so it was done on your machine then pushed directly to the main repo. I can probably figure it out from there, I've been looking for an option to do it on the Github web interface, all this copying to/from does seem remarkably redundant.
Mat Bowles
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Re: The Git/GitHub Questions, Answers and Howto Thread
Exactly.MatGB wrote:Ah, so it was done on your machine then pushed directly to the main repo.
I strongly recommend not to use the github web interface for anything else than pull requests. Use a git gui client for normal operation. You'll save yourself a lot of headache.I can probably figure it out from there, I've been looking for an option to do it on the Github web interface
Re: The Git/GitHub Questions, Answers and Howto Thread
Aha!
To cherry pick in Git GUI, Repository menu, visualise 'BRANCHNAME' history. Find the last commit you want to keep, select then right click on it, revert to there. Then go up to more recent stuff and right click on the commits you want to add, this will take them out of the fork and put them back into your 'master', it will also update the files on your machine.
This is especially useful if changes made to the code this week break the AI without a new executable, I thought my game had got a bit easier.
So I think I now know what I'm doing, what I'm not clear on is keeping multiple branches up to date and having one I can commit from that's got my changes in and is up to date, but I'm sure I'll get there, the visualise tool is a lot more useful than I thought at first with all the right click options.
To cherry pick in Git GUI, Repository menu, visualise 'BRANCHNAME' history. Find the last commit you want to keep, select then right click on it, revert to there. Then go up to more recent stuff and right click on the commits you want to add, this will take them out of the fork and put them back into your 'master', it will also update the files on your machine.
This is especially useful if changes made to the code this week break the AI without a new executable, I thought my game had got a bit easier.
So I think I now know what I'm doing, what I'm not clear on is keeping multiple branches up to date and having one I can commit from that's got my changes in and is up to date, but I'm sure I'll get there, the visualise tool is a lot more useful than I thought at first with all the right click options.
Mat Bowles
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Re: The Git/GitHub Questions, Answers and Howto Thread
What do you mean by "keeping multiple branches up to date"? If you mean how to keep the local branches on your computer in sync with their corresponding remote branches, git fetch does just that (for the checked out branch you need to issue "git pull" to merge the changes also into your working copy).MatGB wrote:what I'm not clear on is keeping multiple branches up to date
If the question is how to keep branches up to date with changes that get committed to master, well, that's a bit more work as you'd have to check out each branch and merge master into it.
WRT "keeping up to date", see above, but what do you mean by having one branch you can commit from that contains your changes? You should have separate, independent branches for each set of changes your working on, not one single branch containing all changes. You keep them up to date by frequently merging master into them, and once the feature/fix/whatever you've been working on is finished, you either:and having one I can commit from that's got my changes in and is up to date
- Rebase it onto master, check out master, merge the branch, push master and delete the branch. That should only be done for local branches that never got pushed to the repo.
- Or, in case you've been working on a branch you've pushed to the repo because you've been working with others on this particular set of changes, checkout master, merge the branch, push master and delete the branch.
Re: The Git/GitHub Questions, Answers and Howto Thread
I think I'm getting the hang of all this now.
Aside: I'm using my old laptop for a few days as Winter Leaf's off school and using the main computer herself, so I thought given I had TortoiseSVN installed and Github tells me you can download a repo with that if you just want the code, so I did.
DON'T DO THIS. Seriously, it may look tempting, it's just…
It's given me a a folder called branches, and a folder called tags. In tags there's a list of all the old tagged releases, each gets its own folder. Inside each folder is a full copy of the repo as at that point. In branches, the same, although there's currently only the 0.4.4 release and Joe's bio-weapons branch (I did this when the pull request was still live). So I've got multiple, multiple, outdated copies of the repo in going back years.
You know what it didn't give me? A copy of the current main repo. The only thing I actually wanted.
If I need to use this machine regularly, I'll install Git on it.
Aside: I'm using my old laptop for a few days as Winter Leaf's off school and using the main computer herself, so I thought given I had TortoiseSVN installed and Github tells me you can download a repo with that if you just want the code, so I did.
DON'T DO THIS. Seriously, it may look tempting, it's just…
It's given me a a folder called branches, and a folder called tags. In tags there's a list of all the old tagged releases, each gets its own folder. Inside each folder is a full copy of the repo as at that point. In branches, the same, although there's currently only the 0.4.4 release and Joe's bio-weapons branch (I did this when the pull request was still live). So I've got multiple, multiple, outdated copies of the repo in going back years.
You know what it didn't give me? A copy of the current main repo. The only thing I actually wanted.
If I need to use this machine regularly, I'll install Git on it.
Mat Bowles
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
- adrian_broher
- Programmer
- Posts: 1156
- Joined: Fri Mar 01, 2013 9:52 am
- Location: Germany
Re: The Git/GitHub Questions, Answers and Howto Thread
"You're doing it wrong."™MatGB wrote:DON'T DO THIS. Seriously, it may look tempting, it's just…
When "checking out" something in SVN you check out a directory. SVN does not know any concept of "branches" or "tags". Instead of that there is only an convention like:
1. In the root of the SVN repository there are 3 directories, called "trunk", "branches" and "tags".
2. You don't check out the root of the repository. Instead you check out the "trunk" folder within the repository to work on the main development branch or, instead the branch you want to work with.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz
Re: The Git/GitHub Questions, Answers and Howto Thread
Aaah... OK yeah, I was doing it wrong, not that it matters that much.
Mat Bowles
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.