Shares

Git is a popular distributed revision control and source code management system that is used by professionals in the software industry. It was initially designed and developed by Linus Torvalds of Linux fame as a repository technology that allows the developer to see a complete history of the code with full revision tracking capabilities, independent of a central server. Git has increased in popularity over the years due to the open-source phenomenon where hackers and passionate coders come to fork projects at will. If you are here to read about the 26 most used Git commands, you might have already come across BitBucket.com and GitHub.com, two websites which allow you to host your code based on the Git technology. Oh, git is free and so is this cheat-sheet for our Mr. Geek readers.

$ mkdir repos
$ cd ~/repos
$ git clone https://mrgeek@bitbucket.org/mrgeek/repository01.git
$ ls -al repository01/
$ rm -irf repository01/
$ git clone https://mrgeek@bitbucket.org/mrgeek/repository01.git repository01-practice
$ ls ~/repos
$ cd ~/repos/repository01-practice/
$ ls -al
$ git status
$ git add README
$ git add -A
$ git commit -m "adding repo instructions"
$ git push -u origin master
$ git pull
$ ssh -p 2222 user@domain.com
$ git init --bare foobar.git
$ git rev-parse --show-toplevel
$ git rev-parse --git-dir
$ 'ssh-keygen' on your hostgator server to generate a key
$ ~ is a quick way of typing your home directory
$ rm -rf ~/public_html/localrepo.git
$ git -- update-server-info
$ go to ~/public_html/localrepo.git and type "git pull"
$ git clone git@bitbucket.org:mrgeek/development_repo1.git
$ git config global user.name "Firstname Lastname"
$ git config --global user.email "your_email@youremail.com"

You may ask questions below as usage of these are very specific. Overall, these are all the git commands you will ever need. There are some extra goodies like creating a repository on your hosting account using SSH.

About Ali Gajani

Hi. I am Ali Gajani. I started Mr. Geek in early 2012 as a result of my growing enthusiasm and passion for technology. I love sharing my knowledge and helping out the community by creating useful, engaging and compelling content. If you want to write for Mr. Geek, just PM me on my Facebook profile.