GIT - An Awesomeness - Features and Basic Commands
GIT, a simple command line tool, is a Source Code Management (SCM) system which has the feature of version control system that is an unique characteristic of GIT to manage large project done from different places and by different people.
Features of Git:
Git is both the central and distributed version control system
Nicely controls the different versions of a project work
It is an open source project
Git is used both online and offline
It is fast process to response
Git is small in comparison to SVN
Branching with Git is cheap and Merging is easy
Basic Used Command of GIT:
git init
Initializes the directory for git
Creates a hidden folder
git status
Shows the present status of Git repository
git commit -m "file name"
Commits the staged file to the directory
git add
Add files to stage area to be committed
git remote add origin [email protected]:masummist/repo_name.git
Add origin directory to remote address
git push -u origin master
Push files to origin after modifications
git pull origin master
Pulls files from remote place to local
git diff HEAD
Shows the difference from last commit to the pointer at HEAD
git diff HEAD^
Shows the difference from parent commit to the pointer at HEAD
git diff HEAD^^
Shows the difference from last 2 commits to the pointer at HEAD
git diff HEAD^..HEAD
Shows the difference between parent commit to the pointer at HEAD
git diff HEAD~5
Shows the difference from last 5 commit to the pointer at HEAD
git diff master bird
Shows the difference between the branches of master area
git diff --staged
Shows the difference between the staged files
git reset <directory>
Resets the changes to the commit
git checkout -b <file_name/branch_name>
Create a branch and make it editable
git branch file_name
Creates branch at the directory
git merge branch_name
Merges the branch to the master
git branch -d branch_name
Must delete the branch from local directory
git clone "file directory"
Clones the file from the remote directory to the local
git commit -am "file_name"
Automatically commits the all changes of the file
git remote show origin
Shows the remote origin details/link
git rm
Removes the files and stages the all changes of removal
git tag
Shows the all tags or versions
git tag -a v.0.0.3 -m "version 0.0.3"
Adds the version created new
git push --tags
Pushes all the tags/versions
git remote -v
Shows the remote origins and the directories/links
git log
Shows the history of that repository
git log --until=1.minute.ago
Shows the history from 1 minute ago
git log --since=1.day.ago
Shows the history from 1 day ago
git log --since=1.month.ago
Shows the history from 1 month ago
git log --until=2.weeks.ago
Show the history from 2 weeks ago
git log --since=2012.10.10 --until=2012.10.12
This shows the history of a certain time
git config --global user.name "name"
Configure the user name globally
git config --global user.email "email_ID"
Configure the user email ID globally
git config user.name "name"
Configure the user name locally
git config user.email "email_ID"
Configure the user email ID locally
git rebase
Moves all the changes, all the commits to the temporary area for working temporarily
git reset --hard HEAD^
Undo last commit and all changes
git reset --soft HEAD^
Undo last commit
git commit --amend -m "New Msg"
Changes the last commit
git push -u origin master
pushing files, origin=remote repository name, master=local branch to push
Sources:
www.github.com, www.gitref.com. www.git-scm.com, www.wikipedia.org, www.stackoverflow.com


















