Post date: Apr 27, 2014 8:09:14 AM
From my perspective, I think the best git or even github tutorial for an absolute beginner is from git-scm online book period. It explains very well about the concept, motivation and how to use the git tool to fulfill our needs.
I found this Github tutorial very useful:
There are also great examples using git for version control on IPython Notebook:
http://nbviewer.ipython.org/github/fperez/reprosw/blob/master/Version%20Control.ipynb
There are two different ways to start using Github:
In this case you start create project repo on your own local machine (laptop, desktop) first, and you want to upload the repo to Github later.
$ git init$ git add readme.txt$ git commit -m 'This is my first checkpoint'https://github.com/kittipatkampa/myproj$ git remote add origin https://github.com/kittipatkampa/myproj.git$ git push origin master$ git push --force origin master$ git add readme.txt$ git commit -m 'some additional comments are added to the end of the file'$ git push origin master$ git remote -vThis use case is much easier and less problematic to the previous one.
https://github.com/kittipatkampa/myproj2$ git clone https://github.com/kittipatkampa/myproj2git init or git remote add anymore because when the project is cloned, hence those are initialized for you already.I want to build a git repo for a directory of my python examples and I also want to push it to Github. Here is what I do:
/Users/kittipat/Dropbox/research/python_devgit status. Since my folder has not been initialized, the output is empty:kittipat python_dev $ git statusfatal: Not a git repository (or any of the parent directories): .gitgit init.kittipat python_dev $ git initInitialized empty Git repository in /Users/kittipat/Dropbox/research/python_dev/.git/kittipat (master #) python_dev $ git statusOn branch masterInitial commitUntracked files:(use "git add <file>..." to include in what will be committed).DS_Store.ipynb_checkpoints/date_time_conversion.ipynbdemo_decision_tree_v1.ipynbdemo_nice_pivot_table.ipynbget_leaf_node_id.ipynbiris.pdfiris.pnglib_order_segmentation_python3.ziplib_order_segmentation_python3/my_tutorial/programming_problems/tsne_python/nothing added to commit but untracked files present (use "git add" to track)git add. After that, I checked the repo status again and found 4 files are displayed on the stage area awaiting for commit.kittipat (master #) python_dev $ git add *.ipynbkittipat (master #) python_dev $ git statusOn branch masterInitial commitChanges to be committed:(use "git rm --cached <file>..." to unstage)new file: date_time_conversion.ipynbnew file: demo_decision_tree_v1.ipynbnew file: demo_nice_pivot_table.ipynbnew file: get_leaf_node_id.ipynbUntracked files:(use "git add <file>..." to include in what will be committed).DS_Store.ipynb_checkpoints/iris.pdfiris.pnglib_order_segmentation_python3.ziplib_order_segmentation_python3/my_tutorial/programming_problems/tsne_python/git commit -m 'your message'.kittipat (master #) python_dev $ git commit -m 'all ipynb files are added and first-committed'[master (root-commit) a2df0d9] all ipynb files are added and first-committed4 files changed, 2875 insertions(+)create mode 100644 date_time_conversion.ipynbcreate mode 100644 demo_decision_tree_v1.ipynbcreate mode 100644 demo_nice_pivot_table.ipynbcreate mode 100644 get_leaf_node_id.ipynbkittipat (master) python_dev $ git statusOn branch masterUntracked files:(use "git add <file>..." to include in what will be committed).DS_Store.ipynb_checkpoints/iris.pdfiris.pnglib_order_segmentation_python3.ziplib_order_segmentation_python3/my_tutorial/programming_problems/tsne_python/nothing added to commit but untracked files present (use "git add" to track)python_example.https://github.com/kittipatkampa/python_example.gitgit remote. If output is empty, the folder does not have any remote repo yet.git remote add origin <git URL>.kittipat (master) python_dev $ git remote add origin https://github.com/kittipatkampa/python_example.gitgit push -u origin master.kittipat (master) python_dev $ git push -u origin masterUsername for 'https://github.com': kittipatkampaPassword for 'https://kittipatkampa@github.com':Counting objects: 6, done.Delta compression using up to 4 threads.Compressing objects: 100% (6/6), done.Writing objects: 100% (6/6), 72.91 KiB | 0 bytes/s, done.Total 6 (delta 0), reused 0 (delta 0)To https://github.com/kittipatkampa/python_example.git* [new branch] master -> masterBranch master set up to track remote branch master from origin.Further resources: