Git 2 Minutes
Installation:
GIT BASH - http://git-scm.com/downloads
GUI's:
Eclipse: E-git
Clone Repository:
git clone git_url
Clones the git repository in the local
GIT Configuration:
git config --list
Check the git configuration
git config --global --edit
Edit the git config
.gitignore
Ignoring files during commit
Get the attached file and put in the GIT HOME Directory..gitignore_global
Git Changes
git status
List the current changes
Git Pull
git pull
Get the contents of remote repository changes into local
Git Add:
git add
Adds the specified file for commit
git add -u
Adds all the files marked 'Untracked' to commit
git add .
Add all the files tracked, untracked for commit
Removing file from cache:
Not yet ready to commit some file just remove them from the commit cache
git rm --cached filename
Branching:
git checkout
To switch branches and to create new branches in the local
git branch -a
List all the branches including remote branch
git branch -r
List remote branches only
git branch
Display the current branch
git branch new_branch
Create a new branch or switch branches
Push to remote branch
Intermediate commits: Stashing
When you middle of something and want to work on some fix, don't want to commit it yet then stash it.
git stash
Stacks up the current changes, does not commit it) , you can also do
git stash stash_name
Stash name reference if you want refer in the future
Commit
git commit 'commit msg'
Commits all the changes under commit label
Push
git push
Push the contents to the remote git repository
GIT Changes
Want to generate a report of recent changes then log it
git log -p > filepath
To get code differences
git log > filepath
To get commit differences
Comments