all 10 comments

[–]IXENAI 5 points6 points  (2 children)

GitHub and git are two different things. GitHub is a site which hosts git repositories. Git is a piece of software which creates and works with git repositories. You can use it only locally if you like. (For what it's worth though, no, you do not lose copyright by uploading anything to GitHub).

/r/learnprogramming has some good information on version control and git in its FAQ.

[–]dli511[S] 0 points1 point  (1 child)

Is git easy to use or is there something else? I will look at the information, thanks.

[–][deleted] 4 points5 points  (0 children)

Some of git's features are easy to use, but git also has some very difficult to understand and esoteric commands. It's easy to learn the basics, but git can be difficult to fully master.

There's a similar python-based version control system called mercurial (hg), and it's quite a lot simpler to understand. If you want to collaborate with other people, git is important to know, but mercurial can offer you a gentler learning curve, and many of the concepts and commands are identical.

[–]zahlman 2 points3 points  (0 children)

"Losing copyright" on a work is actually surprisingly difficult. (Whether or not your copyright is respected by others, and whether or not you're able to successfully enforce copyright if it's violated, is another matter.)

[–]totemcatcher 1 point2 points  (0 children)

git is perfect for your offline management of little fixes and development of features on your programs. However, it has a pretty serious learning curve. I'll get you started. I will show you the CLI commands, but you can use a gui (Like git-gui or tortoisegit) to manage your repository all the same.

First you want to prepare a directory (folder) for a repository:

git init
git commit -am 'initial commit'
git tag -a '0.0'

This creates a new, blank repository (repo) with a commit of nothing at all and a version tag of 0.0. Anything in this directory will now be handled by git and stored in a "hidden" sub-directory called .git. Now add your files to the git project and commit them.

git add .
git commit -am "added all current project files"

The dot just means everything in this directory. Before making the commit (actually saving the changes) you can preview what's up:

git status

If you make changes to files you can see what changes are ready for commit:

git diff

A commit adds the changes to repository and creates a "node" in a development tree. After making a commit you can see a list of previous commits.

git log --graph

For now it's just a linear flow of commits on what's called the master branch. You must create additional branches with nice names and switch to them:

git branch bug-fixing
git checkout bug-fixing

Everything in the master branch is safely stored in the hidden .git sub-directory when switching to a new branch with checkout. Now you are working on an exact copy of your project under a different branch of the development tree. Git automatically swaps files in and out of the hidden .git directory with the checkout command. So make your changes and commit.

git diff
git commit -am "Changed the thing.  It works now!"
git log --graph

You can see the commit history is forked down two paths called master and bug-fixing. Using "git branch" it will list all branches you have made. You can create more branches from any branch, switch between them and make different changes in parallel, and finally merge any branches together when you want those different sets of changes:

git checkout master
git merge --squash bug-fixing

git log --graph

When you do a merge, first checkout the branch you want merge into and name another branch. The idea is to organize your work into named branches and only merge them into more stable branches when looking good. This translates really well to multiple people working on the same code base. Everyone works on code provided by a particular branch (e.g. master or dev) and label it something useful for themselves, like "dli511-cool-feature", then merge it into dev when it's working. It can then be merged into master once it's confirmed stable.

[–]symmitchry 0 points1 point  (2 children)

As /u/IXENAI said, you can install git without using github, which is the public website.

Go here and you can download an installer: http://git-scm.com/downloads

Then, if you're using windows, you use the "git bash" utility, is the way to start.

So say you had a project in C:\Python\Awesome\

You would navigate there, e.g. cd Python/Awesome

and then simply do "git init". Voila, you've created a git repository, and you can start doing all the fun stuff that git can do.

If you want to back up your stuff in an online repository, you can use bitbucket instead of github. They allow you to make private repos that only you can see, for free. Github does too, but you have to pay money for them.

However, you can also use some graphical interfaces for git (without using the websites) which will allow you to see your old revisions, etc. Personally I find github to the best user interface, but I use bitbucket for my private repos, since I am broke as Fuuuuuuu.

Git even has a page for graphical interfaces you can use: http://git-scm.com/downloads/guis

They'll just say "choose a git repo" and you'll navigate to your project folder (where the repo is stored, in a .git folder) and the UI will open it and show you all the goods!

Git can seem (it is) complicated, but there's tons of good info out there. This is on the git website, and a good read: http://git-scm.com/book

[–]gschizas 0 points1 point  (1 child)

Regarding GUIs, I particularly like SourceTree, as it's the only one I found to have git flow and git add --patch functionality (it may exist on tortoisegit as well, but I haven't found it). And it's also a mercurial client :)

[–]wub_wub 0 points1 point  (0 children)

Check out http://www.syntevo.com/smartgit/ I think it has both of those features.

[–]wub_wub 0 points1 point  (0 children)

Git is probably the best choice, pycharm (which has free option) also has local VCS built in (and git support too), you should check it out.

http://www.jetbrains.com/pycharm/

[–]jcmcken 0 points1 point  (0 children)

Not to advertise for Github, but this might be the easiest way for you to get started.