Git - The Simple Guide - No Deep Shit!
Git - The Simple Guide - No Deep Shit!
io/git-guide/
just a simple guide for getting started with git. no deep shit ;)
Tweet 4,747
by Roger Dudler
this guide in deutsch, español, français, italiano, nederlands, português, русский, türkçe
1 of 13 3/20/2015 9:53 PM
git - the simple guide - no deep shit! http://rogerdudler.github.io/git-guide/
2 of 13 3/20/2015 9:53 PM
git - the simple guide - no deep shit! http://rogerdudler.github.io/git-guide/
your local repository consists of three "trees" maintained by git. the first
one is your Working Directory which holds the actual files. the
second one is the Index which acts as a staging area and finally the
3 of 13 3/20/2015 9:53 PM
git - the simple guide - no deep shit! http://rogerdudler.github.io/git-guide/
git add *
This is the first step in the basic git workflow. To actually commit these
changes use
git commit -m "Commit message"
Now the file is committed to the HEAD, but not in your remote
repository yet.
4 of 13 3/20/2015 9:53 PM
git - the simple guide - no deep shit! http://rogerdudler.github.io/git-guide/
Your changes are now in the HEAD of your local working copy. To send
those changes to your remote repository, execute
git push origin master
Change master to whatever branch you want to push your changes to.
If you have not cloned an existing repository and want to connect your
Now you are able to push your changes to the selected remote server
Branches are used to develop features isolated from each other. The
master branch is the "default" branch when you create a repository. Use
other branches for development and merge them back to the master
5 of 13 3/20/2015 9:53 PM
git - the simple guide - no deep shit! http://rogerdudler.github.io/git-guide/
a branch is not available to others unless you push the branch to your
remote repository
6 of 13 3/20/2015 9:53 PM
git - the simple guide - no deep shit! http://rogerdudler.github.io/git-guide/
to merge another branch into your active branch (e.g. master), use
git merge <branch>
7 of 13 3/20/2015 9:53 PM
git - the simple guide - no deep shit! http://rogerdudler.github.io/git-guide/
concept, which also exists in SVN. You can create a new tag named 1.0.0
by executing
git tag 1.0.0 1b2e1d63ff
the 1b2e1d63ff stands for the first 10 characters of the commit id you
want to reference with your tag. You can get the commit id by looking at
the...
in its simplest form, you can study repository history using.. git log
You can add a lot of parameters to make the log look like what you want.
To see only the commits of a certain author:
git log --author=bob
Or maybe you want to see an ASCII art tree of all the branches,
decorated with the names of tags and branches:
8 of 13 3/20/2015 9:53 PM
git - the simple guide - no deep shit! http://rogerdudler.github.io/git-guide/
These are just a few of the possible parameters you can use. For more,
In case you did something wrong (which for sure never happens ;) you
can replace local changes using the command
git checkout -- <filename>
this replaces the changes in your working tree with the last content in
HEAD. Changes already added to the index, as well as new files, will be
kept.
If you instead want to drop all your local changes and commits, fetch the
latest history from the server and point your local master branch at it
like this
git fetch origin
9 of 13 3/20/2015 9:53 PM
git - the simple guide - no deep shit! http://rogerdudler.github.io/git-guide/
graphical clients
10 of 13 3/20/2015 9:53 PM
git - the simple guide - no deep shit! http://rogerdudler.github.io/git-guide/
guides
Git Community Book
Pro Git
Think like a git
GitHub Help
A Visual Git Guide
get help
Git User Mailing List
#git on irc.freenode.net
11 of 13 3/20/2015 9:53 PM
git - the simple guide - no deep shit! http://rogerdudler.github.io/git-guide/
429 Comments
Jayant •
Awesome. Thanks!
• •
Schmidt •
Bookmarked!
• •
Sean Leary •
Awesome, thanks!!
should read:
Chris Wolf •
Thank you for this! So incredibly useful and helpful! Some other things I found
helpful too...
donna •
Thank you for this! Its excellent and easy to understand! I am not a developer,
but a configuration manager role, and trying to establish some processes for
developers using git. Question on branching, if there is a release_1.0 branch, I
want to be the one to merge it to master when it is ready. I'm confused how I
would go about doing that merge. Can you tell me how to execute that merge? Is
it $git merge release_1.0 master ?? Thanks so much!
• •
Nico Christie •
Hi, maybe I'm not understanding something, but I'm having some problems with
branches. I'd like to have a branch for developing and local testing and merge
with main when tests are successful. I created a branch and can commit to it, but
I can't seem to find a way to fetch the files on another computer. A fetch will
succeed, but no files are updated locally. Any hints on this? Thank you very much
and congrats on a very simple introduction to git new users!
• •
Oleksandr Vasiliev •
Hi, Nico!
Are you checking out your new branch on another computer? To see if you
have really fetched the branch use *git branch*. If the branch is in the list,
just *git checkout <branchname>* to it.
Edit: You have to create local branch that tracks changes on remote
12 of 13 3/20/2015 9:53 PM
git - the simple guide - no deep shit! http://rogerdudler.github.io/git-guide/
13 of 13 3/20/2015 9:53 PM