git - the simple guide just a simple guide for getting started with git. no deep shit ;) Tweet
4,747
by Roger Dudler credits to @tfnico, @fhd and Namics this guide in deutsch, español, français, italiano, nederlands, português, русский, türkçe, , 日本語, 中文, 한국어 Vietnamese please report issues on github
open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
setup Download git for OSX Download git for Windows open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
Download git for Linux
create a new repository create a new directory, open it and perform a git init to create a new git repository.
open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
checkout a repository create a working copy of a local repository by running the command git clone /path/to/repository when using a remote server, your command will be git clone username@host:/path/to/repository
open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
workflow 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 HEAD which points to the last commit you've made.
open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
add & commit You can propose changes (add it to the Index) using open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
git add 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.
open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
pushing changes 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 repository to a remote server, you need to add it with git remote add origin Now you are able to push your changes to the selected remote server open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
branching 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 branch upon completion.
open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
create a new branch named "feature_x" and switch to it using git checkout -b feature_x switch back to master git checkout master and delete the branch again open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
git branch -d feature_x a branch is not available to others unless you push the branch to your remote repository git push origin
update & merge to update your local repository to the newest commit, execute open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
git pull in your working directory to fetch and merge remote changes. to merge another branch into your active branch (e.g. master), use git merge in both cases git tries to auto-merge changes. Unfortunately, this is not always possible and results in conflicts. You are responsible to merge those conflicts manually by editing the files shown by git. After changing, you need to mark them as merged with git add before merging changes, you can also preview them by using git diff open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
tagging it's recommended to create tags for software releases. this is a known 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 with open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
git log you can also use fewer characters of the commit id, it just has to be unique.
replace local changes In case you did something wrong (which for sure never happens ;) you can replace local changes using the command open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
git checkout -- 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 git reset --hard origin/master
open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
useful hints built-in git GUI gitk use colorful git output git config color.ui true show log on just one line per commit git config format.pretty oneline use interactive adding open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
git add -i
links & resources graphical clients GitX (L) (OSX, open source) Tower (OSX) Source Tree (OSX, free) GitHub for Mac (OSX, free) GitBox (OSX, App Store) open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
guides Git Community Book Pro Git Think like a git GitHub Help A Visual Git Guide
comments AROUND THE WEB
open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
Penny Stocks: The Investment You
Eat THIS, Never DIET Again!
9 Huge Celebrities Who Are
Can Afford Invests.com
Healthy LifeStyle
Surprisingly Small
ALSO ON GIT - THE SIMPLE GUIDE
git - hướng dẫn đơn giản 3 comments
git - een simpele uitleg - no deep shit!
git - la guía sencilla 43 comments
git - 간편가이드 - 어렵지 않아요!
167 Comments
git - the simple guide
Sort by Newest
Join the discussion… JoeShep
•
4 days ago
I shared this with a class I'm teaching. Great guide that helped me a ton when I was learning git. Thanks. • Reply • Share ›
Skr
•
4 days ago
Thanks for this explanation. I've been programming for years and using SVN with relative ease but since GIT came along I've been pulling hairs. If there's one piece of software that really spoils my day each time, it must b git. It seems to be purposely written to make trivial things very, very, complicated. 2 Chad
• Reply • Share ›
•
5 days ago
Best explanation for beginners. I wish more noob tuts were written like this. Straight to the point and no bullshi open in browser PRO version
• • Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
Reply Tim Cinead
•
Share ›
6 days ago
Thanks for this • Reply • Share ›
Martin Gisser
•
10 days ago
I want to merge "master" into my "xxx" branch. The master has meanwhile got a new file. But it does not appear after "git merge master". Now my xxx copy is broken. (Luckily I know about the new file, but suppose I don't.) How can I do this "the right way"? • Reply • Share ›
John
Martin Gisser • 2 days ago
Once you have completed work on your branch "xxx" do the following: 1.) git checkout master (change branch to master) 2.) git pull origin master (pull any new files/new changes from the remote) 3.) git checkout xxx (change back to your xxx branch) 4.) git merge master (copy into your xxx branch all the new files/new changes that you have just got from the remote) 5.) manually fix any conflicts IF any exist (then use git add, git commit once completed fixing those conflicts) 6.) Y our branch xxx is now ready to be merged to master or sent as a pull request now. • Reply • Share ›
DeSilva
10 days ago
•
Great guide.. Thanks for the compilation • Reply • Share ›
Wilhelm
•
10 days ago
Great • Reply • Share ›
open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
Vladyslav
•
12 days ago
Just what a beginner needs! Thank you :) • Reply • Share ›
Shivo
14 days ago
•
Very Helpful Guide, Thank you so much • Reply • Share ›
thcricketfan
•
14 days ago
Great Guide for beginners. Thanks! 1 a
• Reply • Share ›
•
17 days ago
charming • Reply • Share ›
Prasad
18 days ago
•
great tutorial for beginners • Reply • Share ›
Vname Vl
•
23 days ago
one of the coolest user document ;) thx 3 botko10
• Reply • Share ›
•
24 days ago
very nice • Reply • Share ›
Yegor Yefremov
•
24 days ago
Great tutorial! What about mentioning tig (http://jonas.nitro.dk/tig/) as kind of Git GUI? • Reply • Share ›
open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
Kolli
25 days ago
•
Awesome Introduction!! 1 Tes
• Reply • Share ›
•
a month ago
http://google.com 1
• Reply • Share ›
Boyko
a month ago
•
Niiiice! Gracias! • Reply • Share ›
Radhika Bhanu K
•
a month ago
Thank you for this! :) • Reply • Share ›
ihsan
a month ago
•
A simple and an easy explanation !!!! Thanks! • Reply • Share ›
aunlead
•
a month ago
to install gitk on ubuntu sudo apt-get install gitk -y 1 Arjun
• Reply • Share ›
•
a month ago
Thank you for this awesome simple tutorial. Nice starter :-) 1 Chad
• Reply • Share ›
•
a month ago
Thank you for this simple and easy to understand tutorial! open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
• Reply • Share ›
Max
•
2 months ago
awesome, thanks! • Reply • Share ›
Sridhar
•
2 months ago
Great... thanks for sharing.. :) • Reply • Share ›
Sliv TaMere
2 months ago
•
Can't you start by "Git is not centralized, you can't view directly your files in the repository" As a "I trust only what a see" guy, I spent hours seeking my files into the repository... 4
• Reply • Share ›
Lambros Petrou
•
2 months ago
Excellent guide for fast reference! • Reply • Share ›
Wade Welsh
•
2 months ago
A truly simple guide would never mention SSH commands, which I will never use. Very nice tutorial, however. • Reply • Share ›
Vision Websoft
•
2 months ago
Wow! Nicely put together, and the cheat sheet is a great reference companion to print out. • Reply • Share ›
George
•
2 months ago
Thank you! I really needed an idiot-proof way to start with git. :D 1 jiusi liu
open in browser PRO version
• Reply • Share ›
•
2 months ago
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
Thank you! This is REALLY HELPFUL! • Reply • Share ›
Steve
2 months ago
•
Simple and effective. Thanks. How about mentioning git status? 3
• Reply • Share ›
swathi
•
2 months ago
I followed the same steps which are mentioned.but while importing it into my workspace it is giving projects no found. • Reply • Share ›
trepafi
•
2 months ago
Freaking awesome! • Reply • Share ›
biiiiiii
2 months ago
•
Those who are in *nix systems type "man gittutorial" read the official beginners' tutorial. It's pretty good too. 1 usynn
• Reply • Share ›
2 months ago
•
such a git! 1 Parser
• Reply • Share ›
•
2 months ago
Aflatoon. Saved my hours! • Reply • Share ›
Vasco
•
2 months ago
great documentation about Git! but, would be better have a merge conflict situation. it can be really frustrating :/ open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
4
• Reply • Share ›
DGho
3 months ago
•
Wow, as a new user, I had gone through a lot of tutorials that are much more detailed and felt overwhelmed. I love how the simplicity and large, bold font makes it seem so simple. why was I confused before? 4
• Reply • Share ›
Lauhakari [mikko]
•
3 months ago
sourcetree works on Windows too ;) and there is also an Git for Windows... Don't hate :D 1
• Reply • Share ›
Nico Decimo
•
3 months ago
test 3
• Reply • Share ›
Nico Decimo
Nico Decimo • 3 months ago
tes again 3
• Reply • Share ›
Rafal
Nico Decimo • 2 months ago
test test 1 Knight
•
• Reply • Share ›
3 months ago
Nice! Simple and easy to understand 1
• Reply • Share ›
Trang Tung Nguyen
•
3 months ago
Great and easy to understand tutorial! Thank you! • Reply • Share ›
open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
Mere Development
•
3 months ago
gitk! who knew?! 1
• Reply • Share ›
MementoMorrir
•
3 months ago
Excellently done! Finally an easy way to get into git! • Reply • Share ›
Dobromir Penchev
•
3 months ago
All I needed to know. Y ou sir, saved me so much reading! Thanks. • Reply • Share ›
Abdul Aleem
•
3 months ago
Did not remember ,when i have seen something awesome like this before .i have no words to say thank you .. • Reply • Share ›
Load more comments
Subscribe
open in browser PRO version
Add Disqus to your site
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com