Git commands

Git history (got from wikipedia, funny definition, like geek)

Git is a distributed revision control system with an emphasis on speed. Git was initially designed and developed by Linus Torvalds forLinux kernel development. Every Git working directory is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server. Git’s current software maintenance is overseen by Junio Hamano. Git is free software distributed under the terms of the GNU General Public License version 2.

Linus Torvalds has quipped about the name “git”, which is British English slang for a stupid or unpleasant person: “I’m an egotisticalbastard, and I name all my projects after myself. First Linux, now git.”

Start Git

In the terminal, type git

it will show you:

usage: git [--version] [--exec-path[=]] [--html-path]
           [-p|--paginate|--no-pager] [--no-replace-objects]
           [--bare] [--git-dir=] [--work-tree=]
           [-c name=value] [--help]

The most commonly used git commands are:
   add        Add file contents to the index
   bisect     Find by binary search the change that introduced a bug
   branch     List, create, or delete branches
   checkout   Checkout a branch or paths to the working tree
   clone      Clone a repository into a new directory
   commit     Record changes to the repository
   diff       Show changes between commits, commit and working tree, etc
   fetch      Download objects and refs from another repository
   grep       Print lines matching a pattern
   init       Create an empty git repository or reinitialize an existing one
   log        Show commit logs
   merge      Join two or more development histories together
   mv         Move or rename a file, a directory, or a symlink
   pull       Fetch from and merge with another repository or a local branch
   push       Update remote refs along with associated objects
   rebase     Forward-port local commits to the updated upstream head
   reset      Reset current HEAD to the specified state
   rm         Remove files from the working tree and from the index
   show       Show various types of objects
   status     Show the working tree status
   tag        Create, list, delete or verify a tag object signed with GPG

It’s a little boring to read the commands, I think, but for the developer, at least we know how to pick up the “truc”(french word, == things in english) that we need!

So here, what we really need for initialize, create, update, and push a project will be….(a little obvious)

Usually, the procedure that I do is as follows:

rails new books // create a new rails project

git init // create the git file .git

git add . // add all the files in this directory, but don’t forget cd books and the little point

git commit -m “nothing” // commit what u have done, -m => message

git push xxx // push your project to the remote server

And if you use Github, I assume you use it, and I’m sure you will use it. You can add the following lines:

git remote add origin

git push -u origin master


GitHub is a web-based hosting service for software development projects that use the Git revision control system. It is written using Ruby on Rails and Erlang by GitHub, Inc. (previously known as Logical Awesome) developers Chris Wanstrath, PJ Hyett, and Tom Preston-Werner. GitHub offers both commercial plans and free accounts for open source projects. According to the Git User’s Survey in 2009, GitHub is the most popular Git hosting site.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s