Git Introductive

67 %
33 %
Information about Git Introductive

Published on March 19, 2014

Author: AdhamMohammadSaad


Git by Adham Saad

Contents • What is Version Control ? • What is Git • Installing Git • Setup Git for the first time

Contents • Git Basics o Cloning o Staging o Committing o Pushing o Reverting • Git Branching

Contents • Git Stashing • Submodules • Resources

What is Version Control • Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.

What is Git • The major difference between Git and any other VCS (Subversion and friends included) is the way Git thinks about its data. • Conceptually, most other systems store information as a list of file-based changes.

What is Git • This is how other Systems thinks of files

What is Git • Git doesn’t think of or store its data this way. • Instead, Git thinks of its data more like a set of snapshots of a mini filesystem. • Every time you commit, or save the state of your project in Git, it basically takes a picture of what all your files look like at that moment and stores a reference to that snapshot.

What is Git • To be efficient, if files have not changed, Git doesn’t store the file again , just a link to the previous identical file it has already stored.

Installing Git • on Ubuntu $ apt-get install git • For other OS

Setup Git for the first time • There are several servers for git , in which we can create our repositories o Github ( ) o Bitucket ( ) o Assembla ( ) • Let’s go to bitbucket and create an account for free.

Upload your Ssh key • Go to and follow the steps to upload your ssh key to bitbucket ( dd+an+SSH+key+to+an+account )

New Repository • Create a new repository from here • Follow the steps introduced to you from the website to use the repo for the first time

Adding Files • After cloning your repository , cd to it • Add a new text file $ git commit -m “your message” • Here you have added your files to the staging state but not to the server $ git push • You have added your file to the server

Adding Files

Sharing • Let’s share one repository with all of us • One of us will make changes , commit and push • The others should see his changes after running git pull

Branching • Branching in git is not used to solve day to day issues , but usually for introducing new releases , or for working on something different than the master branch (like design)

Branching • Create new branch $ git checkout -b newbranch • This is a shorthand for $ git branch newbranch $ git checkout newbranch • This is also how to switch to an existing branch. $ git checkout master

Stashing • Sometimes , you didn't finish your task yet , but you want to pull the latest changes from the server, and if you do you might have conflicts. Here comes git stash . • The stash command is saving all your non committed changes to something like a stack, and the you can pop it again

Stashing $ git stash $ git pull $ git stash pop

Submodules • Git also provides an easy way to include libraries called submodules • Suppose you want to add zend framework 2 library in your project , it is simply by running the following

Submodules $ git submodule init $ git submodule add library/zf2 • Note that you might need to add your ssh key to github too )

Submodules • You can clone a repo with its submodules by running $ git clone <repo_ssh_url> -- recursive • or after cloning it you can run $ git submodule init $ git submodule update

Resources • (Please update this page if you found something interesting) •


Add a comment

Related pages

Commits · MozOpenHard/wot-introductive-toolkit · GitHub

Contribute to wot-introductive-toolkit development by creating an account on GitHub.
Read more

adc support

@@ -1,6 +1,3 @@-/* This Source Code Form is subject to the terms of the Mozilla Public- * License, v. 2.0. If a copy of the MPL was not distributed with ...
Read more

Lehrstuhl für Biophysik - Index-Seite (englisch)

Introductive articles (only in German): ... GIT Labor-Fachzeitschrift 9/2008, S. 772–774 (PDF-File - 371kB) Kötting, C., Gerwert, K.
Read more

United Nations Mission to Investigate Allegations of the ...

United Nations Mission to Investigate Allegations of the Use of Chemical Weapons in the Syrian Arab Republic Report on the Alleged Use of Chemical Weapons ...
Read more

Mipraa Village Introduction I - YouTube

Its an introductive video of documentary based on Mipraa Village Home stay Program. Give your reviews on it as it is our small try to promote ...
Read more


Read more

Wiley-VCH - Sigrist, Jean-François - Fluid-Structure ...

GIT VERLAG; Verlag ... Sigrist, Jean-François Fluid-Structure ... An Introduction to Finite Element Coupling fulfils the need for an introductive approach ...
Read more

XO ImageQuiz - OLPC - One Laptop per Child

XO ImageQuiz. From OLPC. ... Get introductive reading and further links for each question ... The current source-code is available via git from
Read more