Basic help with GitHub please

Farjo

  • "a valuable asset to the community"
  • Posts: 492
Basic help with GitHub please
« on February 27th, 2014, 01:09 PM »
So a while ago I changed some language files for the UK. However it turns out I need to install various software (rather than amending on the github website) and Nao has tried to explain how to do this. However I have trouble following his more technical descriptions and obviously he hasn't the time (or the patience :) ) to hand-hold me.

I want to do more UK amendments (e.g. for the plugins) so installing it all seems a good idea. However I am stuck.

Can someone please help me in simple language to finish the process.


I started amending the files just on the github.com web pages. I amended an english file here: https://github.com/Farjo/languages/commit/d3e3a7167fa405b063ad24d45c14d71e99858a5c
However I missed a comma and amended it again: https://github.com/Farjo/languages/commit/cb5e207bd656bbef7bcf6f418233dee3250d6974

When Nao asked me to amend my previous commit (i.e. the one with only the comma changed), and I replied that I couldn't find the command on the web site, he gave me these instructions to install various software:
Quote
What you want to do is install TortoiseGit (along with msysgit... Follow instructions on the TortoiseGit website!), then clone the languages repo into a folder (easy way is to use 'fork to Windows' on the github website, hopefully Tortoise will 'catch' the link and create the repo for you), then change the contents, and commit to the local repo using TortoiseGit. If you're already doing that, you don't need Git Bash, as I said you can simply amend your latest commit by launching the Commit window, and then checking the 'amend last commit' checkbox. It'll automatically merge your new stuff to the last commit.
Quote
git commit --amend (or git commit -a) is a command that will take your last commit, and consider it 'undone'. Your next commit will then integrate anything that was in the last commit, plus whatever you added. Basically, it's like a rebase + squash.

In TortoiseGit (my favorite Git client), you can amend a commit by simply launching the Commit window, and clicking the 'amend last commit' checkbox. Your last commit will then be shown, and you can complete it manually with whatever files are changed.
Then, you just submit, and push to your repo. (You'll probably have to force-push, there's a checkbox for that too, because your latest commit will have been deleted, and GitHub can't "fast-forward" its own local copy to yours.
This was all a while ago, but as I have been 'on the road' I have not had a chance (or decent internet connection) to look in much depth. However I am now in one place for a few weeks so here we go!

This morning I have installed a bunch of programmes which are now listed under "Github, Inc" and "TortoiseGit". I have cloned the Wedge/languages repo and in the GitHub screen on my PC this shows as a local repository, as does Farjo/rep. However if I clone Farjo/languages I just get another copy of Wedge/languages.

On Windows, within the TortoiseGit group, I have no icon called "Commit window" or anything similar.

There's also this change https://github.com/Farjo/languages/commit/5415cd12604ca9226b64954652bb94464b92c0df which hasn't been incorporated into the Wedge/languages master and I do not know how to do so.


So if anyone can have a look and explain in plain English I would be most grateful.

Thank you for reading :)

Nao

  • Dadman with a boy
  • Posts: 16,077
Re: Basic help with GitHub please
« Reply #1, on February 27th, 2014, 02:45 PM »
A few tips...

- TortoiseGit menu: the entry is called Git Commit -> "master", dunno if it's the same for you. You can edit the list of available menu commands through TortoiseGit > Settings > first 2 entries in the list view. Personally, I like having "Git Commit", "Git Show log" and "Git Blame" entries outside of the TortoiseGit menu group, because they're the 3 entries I use the most. I also use "Push" a lot obviously, but I prefer not to have it easily accessible.

- TortoiseGit > Settings > Git > Remote is one of the most important git settings. It allows you to control your 'remotes'.

A 'remote' is simply a URL that points to a remote repository, usually at GitHub, but it can be on any server that supports git of course, or even on your own machine, using the file:// protocol, for instance.
The 'common' way of doing things is:
- Add a remote called 'origin' which points to your Farjo/languages. For instance, https://github.com/Farjo/languages.git (you can add "Farjo@" before "github.com", so you don't have to enter your name in addition to your password. Of course, I'd strongly recommend that you use a tool to automatize git credentials, you can set this up in TortoiseGit > Settings > Git > Credentials.)
- Add a remote called 'upstream' which points to my Wedge/languages repo. i.e., https://github.com/Wedge/languages.git (of course.)

Now, the process...
- Right-click your repo, Pull, choose to pull from "upstream".
- Make your modifications.
- Push to "origin". Go to GitHub, and make a pull request.
- Anytime before making changes to your repo, make SURE to Pull upstream, otherwise you may break something.

As a note, you can also set your repo's pull origin & push destination to default values, but you'll have to use the command line for that. And I think that these days, TortoiseGit automatically selects your last pull/push remote, so it shouldn't be a problem.

Farjo

  • "a valuable asset to the community"
  • Posts: 492
Re: Basic help with GitHub please
« Reply #2, on February 27th, 2014, 06:08 PM »
I didn't want to drag you into this, but thanks for the reply. I've done all that however when I right-click to do Git commit->master and get the dialog box, when I tick the 'amend last commit' box I only get your change to the Search.french.php file. How do I get to my 'patch1' and 'patch2' branches?

Nao

  • Dadman with a boy
  • Posts: 16,077
Re: Basic help with GitHub please
« Reply #3, on February 27th, 2014, 06:12 PM »
Hey, I have no problems helping out on things that I myself had to learn the hard way... Sometimes, a tutorial is just what you need.
What I suck at, though, is turning my hints into proper documentation and tutorials... I believe, it's called the developer syndrome. :P

You can switch branches by using the 'Switch/Checkout' menu entry.
However, if you also have msysgit installed, it should have added a few other entries to your menu, so just right-click your repo's root folder, find 'Git Branch' (NOT in the TortoiseGit menu!), and then choose your desired branch!

Farjo

  • "a valuable asset to the community"
  • Posts: 492
Re: Basic help with GitHub please
« Reply #4, on February 27th, 2014, 08:01 PM »
I've recommitted but I think it's worse - 4 commits instead of 2. It just doesn't do what I want it to!!

If it's not right I'll have a look tomorrow, I'm too fed up with it for tonight.

Given that language guys may not be that technical it may be a tall order to ask them to go through all that.

Pandos

  • Living on the edge of Wedge
  • Posts: 635
# dpkg-reconfigure brain
error: brain is not installed or configured

Nao

  • Dadman with a boy
  • Posts: 16,077
Re: Basic help with GitHub please
« Reply #6, on February 27th, 2014, 08:19 PM »
Quote from Farjo on February 27th, 2014, 08:01 PM
I've recommitted but I think it's worse - 4 commits instead of 2. It just doesn't do what I want it to!!

If it's not right I'll have a look tomorrow, I'm too fed up with it for tonight.

Given that language guys may not be that technical it may be a tall order to ask them to go through all that.
I agree, but I don't have any better alternatives to offer you for now.
The guys at Elk have another tool for translations, but I'm not a fan of separating language translations from code commits.

Anyway, yes, I guess you could still edit files directly at github.com, but it's not very practical in the long run. It's only good for small fixes...
(Why did we decide you shouldn't do that, already..?)

Pandos

  • Living on the edge of Wedge
  • Posts: 635

Farjo

  • "a valuable asset to the community"
  • Posts: 492
Re: Basic help with GitHub please
« Reply #8, on February 27th, 2014, 08:40 PM »
OK, will have a go with SourceTree - thanks.

"(Why did we decide you shouldn't do that, already..?)"
It was that comma. You didn't want to make two commits and so asked me to amend the second commit. When I said I couldn't see how from the website you suggested downloading github and tortoiseGit. At first I thought "you want me to do what with what???" But then like I said above I figured I'd be doing other UK files and thought it would make it easier (once set up).

Nao

  • Dadman with a boy
  • Posts: 16,077
Re: Basic help with GitHub please
« Reply #9, on February 27th, 2014, 08:59 PM »
Quote from Pandos on February 27th, 2014, 08:33 PM
IMHO files edited directly are not signed-off?
Ah yes, that was the main reason...
Although language files are in a MIT repo, so it's not much of a problem, but I'd still rather have everyone sign off.
(Actually, I'm currently considering starting to sign-off my commits for the Wedge repo as well... Yeah, why not? It's just an extra click...)

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,668
A confident man keeps quiet.whereas a frightened man keeps talking, hiding his fear.

Farjo

  • "a valuable asset to the community"
  • Posts: 492
Re: Basic help with GitHub please
« Reply #11, on February 28th, 2014, 08:36 AM »
Thank you. I guess I was starting with something difficult i.e. amending a second, month-old commit. Beginning with a few minor changes will be better!

Pandos

  • Living on the edge of Wedge
  • Posts: 635