3790 posts
Location
Lincoln, Nebraska
Posted 15 February 2013 - 05:48 AM
Okay, so I have been programming for almost a year now, with sole focus on Lua as it relates to ComputerCraft. I am told that I should have a GitHub account so I can organize and track my code. I do not know how to use GitHub, but I am determined to find out, as I am told it is a powerful tool for any serious programmer.I have tried using the help section of GitHub.com, but they seem to assume I already know what a git is, or how to use bash command line programming. I don't.I do have an account, I do have the Git bash installed, as well as the GitHub application installed.I have a few questions:- What is a repository?
- How do I make one?
- How do I make changes to it once it's created?
- How do I make my changes appear on GitHub?
- Why should I use this over something like Pastebin?
If you guys could answer these questions, it would be great. I know my noob is showing, but hopefully you guys don't tear into me too hard.
EDIT: No idea how this topic got pinned/locked…… fixed now.
Edited by
2088 posts
Location
South Africa
Posted 15 February 2013 - 06:05 AM
I actually don't use it either (too lazy to create an account, lol)
I can tell you that a repository is just a storage location for files. So you can separate each one of your programs into their own folders for neatness.
Also for no. 5 - people would probably say because of the repositories for sorting each programs, especially if you have a lot of programs so it's just easier to find/locate and share.
1243 posts
Location
Indiana, United States
Posted 15 February 2013 - 06:07 AM
Git is a powerful versioning tool.
8543 posts
Posted 15 February 2013 - 06:14 AM
Git is a version control system. It allows you to make, track and revert specific changes. You can use it as a debugging tool (to see which change broke a certain piece of your code's functionality), and it allows you to branch off and play around with your code without affecting your "clean" published version.
A repository is a container, essentially. You usually use a repository for each project. A repository contains your code. Each repository has at least one branch in it. You can start a new branch from any point in the history of any current branch. When you create a repository, I believe git usually creates a "master" branch for you. Each time you make a change to your code, you create a new commit on your branch (this is usually done when adding or making significant progress on a feature, fixing a bug, etc.). This commit will be automatically added to whichever branch you are currently on when you commit it. There are three different "areas" where code lives in the repository. These three areas are not apparent to anything outside git. Only git knows about these three areas. They are unstaged changes, staged changes and committed changes.
Whenever you make a change to a file, those changes start out in the unstaged area. You can use `git add filename` to move these changes to the staged changes area. Only staged changes will be commited when you use `git commit`. That way, if you make unrelated changes in another file (or even the same file), you don't have to commit the unrelated changes when you commit the rest. Once in the staging area, you can remove the file/changes or commit them. Committing the changes will remove them from the staging area and add a new commit on the current branch.
You can start a new repo with `git init`.
To make your changes appear on github, you set up a remote using the git URL github provides for the repository you created on github. You then push to that remote. If your remote is named "origin", you would use this to push the current branch to master on github: `git push origin master`.
Pastebin only provides hosting, it isn't version control.
Feel free to ask more questions if any of my explanations are insufficient or confusing.
7508 posts
Location
Australia
Posted 15 February 2013 - 06:22 AM
Additionally to what Lyqyd said you could also use GitHub's new GitHub GUI, which is aimed at making everything a little easier and not having to remember all the command line commands. I use the GitHub GUI as it makes everything much easier, there are a few times its annoying though ;)/> :P/>
But yes using GitHub is a good idea.
A main reason is you can use branches. With all my projects I have 2 branches, a 'master' branch which is default and I use this as the 'release' version. I then also have a 'develop' branch is where I do all my development.
This is handy when I get a bug report and I do a quick fix, I can switch to the 'master' fix, commit and then switch back to 'develop' and keep working on whatever I was doing in the new version. Additionally you can always rollback your branches to a previous commit if you changed something you didn't mean to, or something of the such.
3790 posts
Location
Lincoln, Nebraska
Posted 15 February 2013 - 07:33 AM
Ok, you guys are all so very helpful. I will most likely have more questions about this later, but I'm at work, so I can't get into it for now.
620 posts
Location
Holland
Posted 15 February 2013 - 08:28 AM
Oh and if you want to learn git itself a bit more try
http://try.github.com
3790 posts
Location
Lincoln, Nebraska
Posted 17 February 2013 - 12:45 PM
ok, so I have the GUI, but it seems that nothing I do will sync with GitHub.
I press the sync button, but it never goes past 0%
264 posts
Location
Where you aren't
Posted 17 February 2013 - 04:41 PM
You are probably missing a "RSA key" popup.
You need to tell it Yes.
224 posts
Location
Auckland, New Zealand
Posted 17 February 2013 - 04:52 PM
GitHub is annoying to use -_-/>
799 posts
Location
Land of Meh
Posted 17 February 2013 - 05:20 PM
GitHub is annoying to use -_-/>
Only if you don't know how to use it :P/> I luurrrrvvvvveeeeeeeee it soooooo much. It's so useful to revert to previous versions to fix all 1lann's mistakes :3
(loljks 1lann)
3790 posts
Location
Lincoln, Nebraska
Posted 17 February 2013 - 05:25 PM
Alright. Totally fixed it, and it's working like a dream. I think my mistake was downloading everything, then trying to skip parts.
For those interested in the fix, if your repo is not syncing like it should, and is always at 0%, then use the git bash commands to make a repo of the same name as you probably already made using the GUI, then push all the info using the bash commands. If all else fails, delete your local git repo, then use the git bash(or command line, your preference) to create a new repo locally, then link it with an existing repo online. I don't know why it is so derpy….but it is definitely not stupid proof.
ALWAYS FOLLOW INSTRUCTIONS TO THE LETTER!!!!! DO NOT SKIP ANYTHING!!!!
1243 posts
Location
Indiana, United States
Posted 17 February 2013 - 06:00 PM
ALWAYS FOLLOW INSTRUCTIONS TO THE LETTER!!!!! DO NOT SKIP ANYTHING!!!!
Quote of the year.
264 posts
Location
Where you aren't
Posted 18 February 2013 - 08:39 AM
There are no good Git GUIs. You're best off using the git bash. (Which you should know how to use anyways)
SourceTree is looking promising though.
3790 posts
Location
Lincoln, Nebraska
Posted 18 February 2013 - 09:31 AM
There are no good Git GUIs. You're best off using the git bash. (Which you should know how to use anyways)
SourceTree is looking promising though.
I disagree. I do like the GitHub for Windows Gui. It works quite well for me.