Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 03-24-2017, 10:20 AM   #1
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default How to, Q&A: Getting started with Git(Hub) / version control

As questions about Git / version control come up here from time to time, I thought I'd start a 'How to' / Q&A thread.

First some terms:

Version Control

Git

GitHub

Repository


The basics of getting started are already layed out by Argitoth here.

I'm also using SourceTree as my Git client, so I'll refer to doing things in there.

When installing SourceTree, choose the option to install the self-contained Git if you haven't a Git version already on your computer.

I've created a repository on github (containing only an example text file for now) accompanying this thread here.

It's meant purely for experimenting / playing around, so don't worry to break anything. (Actually that's one of the main purposes of this thread, having a repo to try things out and not having to worry about breaking stuff, as would be in a 'real' repo.)

So the next steps I'd suggest if you want to join in is clone / fork the ReaTeam_GitPlayground repo, play around, get familar with "committing", "pushing", "pulling", or creating a pull request

In SourceTree:



If questions come up, post them here and me (or other Git users on the forum) will try to answer.

Have fun !

Links:

'Getting started' tutorial
https://github.com/GSoft-SharePoint/...t-and-git-flow

SourceTree and Git-flow ("branching")
https://blog.sourcetreeapp.com/2012/...-and-git-flow/

Last edited by nofish; 03-24-2017 at 11:26 AM.
nofish is offline   Reply With Quote
Old 04-09-2018, 07:19 AM   #2
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Quote:
Originally Posted by mschnell View Post
OK.
- Found ReaTeam_GitPlayground
- I set it to be "watched"
- "New Pull Request" -> "Create new Pull request" is grayed. Me: "???"
- Alternative: "create new File" -> Editor. Me: Inputting some lines
- Commented and "Propose new file"
- "Create Pull request"
- existing comment is displayed. Me: edited same -> "comment and create pull request" (or similar)
- Seemingly done for now
- I closed the browser

Waiting for an email notification by github.
...
Seemingly not happening. (While I do get notifications from a new "ReaScript" project, very recently created and discussed.) Me: "???"

...

Wanting to edit the file
- -> github.com
- click "nofishfriday/...."
- No mentioning of the new file on this page. Me: "???" (Can't find a not yet committed file for intended editing.)


-Michael
First, I'd suggest to download install SourceTree as I find it so much easier working with it then using command line or doing stuff on the GitHub page directly.

http://downloads.atlassian.com/softw...p_1.9.9.20.exe

(I'm linking this directly because I find 1.x better than the current 2.x version).

I see you've already forked the ReaTeam_GitPlayground repo, good.

Now open SourceTree -> Clone / New and clone your repo into a new folder on your HD to create a local copy.



Then you should see something like this:



There you can also see the branches we currently have, master branch and develop branch.
I've already merged your PR into master branch.

edit:
Above is wrong, sorry.
You first need to merge the changes I've done to my repo (merging your PR) back in your repo to see it.
I'll explain this in a new post.

Now if you want to work on a file, you can edit it locally and SourceTree will display there are uncommitted changes.



When done, you can stage the file, commit and push to your GitHub repo and create a pull request.
Pull requests are always created about branches, btw. not specific single files.
In short, a branch is 'development path' so to say.
https://en.m.wikipedia.org/wiki/Bran...rsion_control))

If you've gotten this far and you're still motivated, tell and we can go on.

Last edited by nofish; 04-09-2018 at 09:25 AM.
nofish is offline   Reply With Quote
Old 04-09-2018, 01:14 PM   #3
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by nofish View Post
I see you've already forked the ReaTeam_GitPlayground repo, good.
I had no idea that I did this. Seems to have happened automatically when I "suggested" a new file. Otherwise I did not do anything special.

OK. I do understand that the original purpose of git is to perfectly support a long winding development process on text (source) files, collectively done by multiple contributors.

Here, we (normally) (ab)use it just for publishing results and automatically evaluate distribute them with the help of a server-site script.

No wonder that there are harsh edges with that.

Obviously when using git in the originally intended way, there is no problem finding an "unmerged" file to modify it, as it simply is locally on my computer.

BTW.: I did get the message "Merged #1. from "nofishonfriday/ReaTeam_GitPlayground".But this is the only one I got.

-Michael

Last edited by mschnell; 04-09-2018 at 09:45 PM.
mschnell is offline   Reply With Quote
Old 04-09-2018, 01:29 PM   #4
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by nofish View Post
When done, you can stage the file, commit and push to your GitHub repo and create a pull request.
As the terms "stage" "commit", "push", and "pull", are rather unclear, and supposedly need a long winding explanation, (while not obviously necessary just to push something in a publicly accessible place), the whole git thing is decently threatening.

-Michael
mschnell is offline   Reply With Quote
Old 04-09-2018, 02:16 PM   #5
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Quote:
Originally Posted by mschnell View Post
I had no idea that I did this. Seems to have happened automatically when I "suggested" a new file. Otherwise I did not do anything special.
Ah, also new to me that you can fork this way.
The 'common' way is via the "Fork" button in GitHub.

Quote:
OK. I do understand that the original purpose of git is to perfectly support a long winding development process on text (source) files, collectively done by multiple contributors.
Correct.

Quote:
Here, we (normally) (av)use it just for publishing results and automatically evaluate distribute them with the help of a serve-site script.

No wonder that there are harsh edges with that.

Obviously when using git in the originally intended way, there is no problem finding an "unmerged" file to modify it, as it simply is locally on my computer.
Correct.

Quote:
BTW.: I did get the message "Merged #1. from "nofishonfriday/ReaTeam_GitPlayground".But this is the only one I got.
Good. Now comes the next step, merging the changes I did on my repo back into your local repo and remote repo.

Quote:
As the terms "stage" "commit", "push", and "pull", are rather unclear, and supposedly need a long winding explanation, (while not obviously necessary just to push something in a publicly accessible place), the whole git thing is decently threatening.
Yeah, it is. Took me admittedly quite a long time to get familiar with it.

In short, simplified terms:

- Push: Upload something from a local repo to a remote repo

- Pull: Download from remote repo to your local copy

- Commit: 'Saving' the changes you've done locally
https://www.git-tower.com/learn/git/commands/git-commit

- stage:
A step that comes before committing:
https://softwareengineering.stackexc...ge-mean-in-git
nofish is offline   Reply With Quote
Old 04-09-2018, 02:28 PM   #6
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

So next step:
A way to get the changes I did on my repo (merging your PR and other changes if this was a real repo) back into your repo, so they are in sync.

For this you have to add my repo as an additional remote repo in SourceTree:
Repository -> Remote settings.



The originating repo (mine in this case) is often called upstream, while your remote of your local copy (your fork) is often called origin btw.

When you've done this you see the upstream repo under the "REMOTES" section and can pull my changes in your local copy et voila.



When done you should see this:


Last edited by nofish; 04-09-2018 at 02:37 PM.
nofish is offline   Reply With Quote
Old 04-09-2018, 09:53 PM   #7
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by nofish View Post
Good. Now comes the next step, merging the changes I did on my repo back into your local repo and remote repo.
Hmmm. I do see that you suggest using GitHub by means of a local copy of the repository. (I already did this with another project, so I do know about that (obviously useful in such situations) feature. But I don't think I am inclined to follow right now.

So no. The "next step" in my book (for myself, and for others, that might want to just publish their strictly locally developed and working stuff in a repository) would be to find a way to edit a file that is "suggested", but not "merged". (This is obviously necessary if the script or the admins decline to merge the file due to improper format.)

With the first test file this is prevented now, as you merged it.

If you are willing to offer more help on this I would just "suggest" a new one (and go on wondering that this is a "fork").

BTW.: I notified you about the merge notification I got (as a result of your action), mainly to state that I did not get any other email notification about that project, which I think is not nice, as maybe such a notification would contain a link that could allow editing the unmerged file.

Quote:
Originally Posted by nofish View Post
Yeah, it is. Took me admittedly quite a long time to get familiar with it.
Exactly this is why I am trying to discuss this. I think we need to find a way to allow contributors to ReaPack to easily publish their stuff without being schooled in climbing in these abysses of git.

-Michael

Last edited by mschnell; 04-10-2018 at 06:17 AM.
mschnell is offline   Reply With Quote
Old 04-09-2018, 10:06 PM   #8
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by nofish View Post
In short, simplified terms:

- Push: Upload something from a local repo to a remote repo

- Pull: Download from remote repo to your local copy

- Commit: 'Saving' the changes you've done locally
https://www.git-tower.com/learn/git/commands/git-commit

- stage:
A step that comes before committing:
https://softwareengineering.stackexc...ge-mean-in-git
I think I now understand what GitHub provides on top of being a standard git server.
It provides a fake local repo for the user, accessible by the web pages.

That is why you need a "pull request" before being able to edit a "merged" (or is it "staged" ? ) file. (Add "merge" and "upstream" to the daunting terms...)

IMHO, for the "normal" ReaPack contributer, only wanting to publish their work, this should be made use of.

-Michael
mschnell is offline   Reply With Quote
Old 04-10-2018, 05:38 AM   #9
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Quote:
Originally Posted by mschnell View Post
So no. The "next step" in my book (for myself, anf for others, that might want to just publish their strictly locally developed and working stuff in a repository) would be to find a way to edit a file that is "suggested", but not "merged". (This is obviously necessary if the script or the admins decline to merge the file due to improper format.)
If by 'suggested' you mean 'currently in a pull request' this is rather straight forward I think.
If a branch (with an edited file) is under pull request but not yet merged, you can simply re-edit it (the file in this case) locally, commit and push the changes to your remote repo and the changes will be added to the current pull request automatically (you update the current pull request so to say).

Quote:
With the first test file this is prevented now, as you merged it.
True. In this case, you'd need to merge it back into your own repo as said above.

Quote:
If you are willing to offer more help on this I would just "suggest" a new one
Sure, go ahead.
But what should I do then ? Simply not merge it ?

Quote:
(and go on wondering that this is a "fork").
No, a fork means 'a copy of a whole repo which is aware of its origin' (in this case my original 'upstream' repo). 'Aware of it's origin' means that you can supply pull requests to the upstream repo.)

http://bryanpendleton.blogspot.com/2...e-vs-fork.html
https://stackoverflow.com/questions/...257901#9257901

Quote:
BTW.: I notified you about the merge notification I got (as a result of your action), mainly to state that I did not get any other email notification about that project, which I think is not nice, as maybe such a notification would contain a link that could allow editing the unmerged file.
See my reply above about editing unmerged files.

Last edited by nofish; 04-10-2018 at 05:43 AM.
nofish is offline   Reply With Quote
Old 04-10-2018, 06:22 AM   #10
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by nofish View Post
If by 'suggested' you mean 'currently in a pull request' this is rather straight forward I think.
If a branch (with an edited file) is under pull request but not yet merged, you can simply re-edit it (the file in this case) locally, commit and push the changes to your remote repo and the changes will be added to the current pull request automatically (you update the current pull request so to say).
IIRC, the term "suggest(ed)" was taken from one of the GitHub webpages (when creating a file and then providing it to the system, which supposedly means to save it in the fake local Repo, GitHub creates for this purpose.
So I suppose it resides in that fake local repo, and maybe same is what I fail to find after re-loggin in.

Quote:
Originally Posted by nofish View Post
Sure, go ahead.
But what should I do then ? Simply not merge it ?
I'll do so tonight.
Yep. I suppose you can't do anything, unless you can come up with a way that I can find and edit this file online in GitHub.
Maybe you can try yourself to create a file online in GitHub to check this out.

Of course I can't merge my unfixed file myself just to be able to edit it. Maybe in the ReaTeam repository this would automatically provide it to ReaPack ?

Quote:
Originally Posted by nofish View Post
No, a fork means 'a copy of a whole repo which is aware of its origin' (in this case my original 'upstream' repo). 'Aware of it's origin' means that you can supply pull requests to the upstream repo.)
Yep. This is why I think GitHub created a (temporary ?) fake local repo for me, to allow the appropriate git-standard actions without needing a real local repo on my PC.


-Michael

Last edited by mschnell; 04-10-2018 at 06:32 AM.
mschnell is offline   Reply With Quote
Old 04-20-2018, 08:55 PM   #11
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Do I need to be added to the playground repo before I can do anything?

I've tried setting this up with Sourcetree, TortoiseGit, Git, and now the Github Desktop client. The first three would at least let me download your repo but I couldn't push (or attempt to push, or make a pull request...) a change. Github Desktop won't even let me add the playground repo at all.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 04-20-2018, 10:28 PM   #12
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

OK.

So you are trying to follow the suggestion to first create a local repo before starting to work on files.

I understand that this indeed is the way git is originally intend to be used (but IMHO it's not the way of choice if you don't want to work with the gitted files but just want to contribute existing files to ReaPack, which should (and is - but seemingly with some drawbacks) possible by using the (somehow hidden) "fake local repo" feature GitHub provides. (See above.)

Let me know how you get along....

-Michael
mschnell is offline   Reply With Quote
Old 04-21-2018, 05:29 AM   #13
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Not sure what you mean about a "fake" local repo - I cloned the Playground repo to a folder on my hard drive, added a text file, committed to the local repo, and would like to push it up to the repo on Github. All I get is authentication errors.

It also won't let me make a pull request, at least not in the same way I would on the Github site.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 04-21-2018, 08:53 AM   #14
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Quote:
Originally Posted by Lokasenna View Post
Not sure what you mean about a "fake" local repo - I cloned the Playground repo to a folder on my hard drive, added a text file, committed to the local repo, and would like to push it up to the repo on Github. All I get is authentication errors.

It also won't let me make a pull request, at least not in the same way I would on the Github site.
You can't push to the Playground repo directly because 'it's mine' so to say (meaning you don't have the sufficient rights to do so currently as you noticed.).

Two posibilities:

- I can add you as a maintainer with full rights if you want.

- (The more common way if you're rather a contributor to some repo but not a maintainer): You can fork it, then 'a copy of it' gets added to your GitHub acoount which you can clone locally, make changes, push to and submit pull requests which I then can merge back into the original Playground repo.


Last edited by nofish; 04-21-2018 at 09:04 AM.
nofish is offline   Reply With Quote
Old 04-21-2018, 09:31 AM   #15
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by nofish View Post
You can fork it, then 'a copy of it' gets added to your GitHub acoount which you can clone locally, make changes, push to and submit pull requests which I then can merge back into the original Playground repo.
This is what I was trying to do. The Github Desktop client seems to be trying to simplify terminology and just ends up making it hard to find what you want.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 04-21-2018, 09:41 AM   #16
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Github Desktop client is actually not needed for forking, you can just click on the 'Fork' button on the repo on GitHub directly (see pic above).
nofish is offline   Reply With Quote
Old 04-21-2018, 10:13 AM   #17
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

I realize that; I was hoping to be able to do everything from the client. Looks like you can't make forks with it. Oh well.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 04-21-2018, 10:19 AM   #18
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Oh ok, misunderstood, sorry.
(I don't use it so I don't know.)
nofish is offline   Reply With Quote
Old 04-21-2018, 12:21 PM   #19
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

I had been using the commandline git client in Linux some years ago, and I am rather sure that there was an option to fork.

-Michael
mschnell is offline   Reply With Quote
Old 04-21-2018, 12:33 PM   #20
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

Forking is a GitHub concept. git itself doesn't know about that.
cfillion is offline   Reply With Quote
Old 04-21-2018, 01:10 PM   #21
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by cfillion View Post
Forking is a GitHub concept. git itself doesn't know about that.
You would think the official Github app would know about it, though. Seems weird to me.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 04-21-2018, 01:44 PM   #22
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by cfillion View Post
Forking is a GitHub concept. git itself doesn't know about that.
Yep it is not called "fork".

I suppose the standard git workalike is "git remote add upstream"

-Micvhael
mschnell is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:31 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.