Install git in Mac
http://code.google.com/p/git-osx-installer, Other OS, please refer here : http://git-scm.com/book/en/Getting-Started-Installing-Git
Initialize a Git repository and make the first commit
$ git init
$ git add .
$ git commit -m "Initial commit"
Create a new repository and push it up to GitHub:
$ git remote add origin git@github.com:<username>/demo_app.git
$ git push origin master
Create a branch and switch to the branch at the same time
$ git checkout - b newbranch-dev
(or)
$ git branch newbranch-dev
$ git checkout newbranch-dev
To List out the available Branch
$ git branch -a
To switch to master branch
$ git checkout master
$ git branch -a
To push the changes to particular branch. (origin is the remote created for the git url using <<git remote add command>>)
$ git push origin newbranch-dev
To get the latest version by cloning the git project, for first time (Reference : http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository)
$ git clone <<git clone public URL>>
To get the latest version from the git project after cloning. (origin is the remote created for the git url using <<git remote add command>>)
$ git pull origin newbranch-dev
To find the difference between current working copy and last version
$ git diff HEAD
To find the difference between any commit and Last version, you can get the commit_id by using this command($ git log -4 --pretty="%h - %s" - will give last 4 commits)
$ git diff commit_id HEAD
To find the difference between last version and previous commit
$ git diff HEAD^ HEAD
To get the current configured git user information
$ git config --list
To undo local changes and restore them to the current versions in the repository
$ git reset --hard
http://code.google.com/p/git-osx-installer, Other OS, please refer here : http://git-scm.com/book/en/Getting-Started-Installing-Git
Initialize a Git repository and make the first commit
$ git init
$ git add .
$ git commit -m "Initial commit"
Create a new repository and push it up to GitHub:
$ git remote add origin git@github.com:<username>/demo_app.git
$ git push origin master
Create a branch and switch to the branch at the same time
$ git checkout - b newbranch-dev
(or)
$ git branch newbranch-dev
$ git checkout newbranch-dev
To List out the available Branch
$ git branch -a
To switch to master branch
$ git checkout master
$ git branch -a
To push the changes to particular branch. (origin is the remote created for the git url using <<git remote add command>>)
$ git push origin newbranch-dev
To get the latest version by cloning the git project, for first time (Reference : http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository)
$ git clone <<git clone public URL>>
To get the latest version from the git project after cloning. (origin is the remote created for the git url using <<git remote add command>>)
$ git pull origin newbranch-dev
To find the difference between current working copy and last version
$ git diff HEAD
To find the difference between any commit and Last version, you can get the commit_id by using this command($ git log -4 --pretty="%h - %s" - will give last 4 commits)
$ git diff commit_id HEAD
To find the difference between last version and previous commit
$ git diff HEAD^ HEAD
To get the current configured git user information
$ git config --list
To undo local changes and restore them to the current versions in the repository
$ git reset --hard
No comments:
Post a Comment
Please include your thoughts/suggestion to make it as a better blog. If you find it useful, Please update with your valuable comments, so that others can use it.