Blogger Template by Blogcrowds.

GIT command reference

Git Create New Repo

create a repository in github, say odesk
create a work folder in ur localmachine. Say odesk
cd odesk
git init
create some sample files
git add . (add the new files in git)
git commit -m “initial commit”
git remote add origin
git push origin master
modify the file
git add
git status -s
git commit -a -s “updateed the file”
git push origin master

Git Branch

git branch
git checkout (make branch as active)
git checkout -b
do the modify in the files and add git add
git commit -a -m “my commit message”
git push origin

Git Merge

git checkout master
git merge hotfix
git push origin master
git –version identify the version
git --help / git help Help
git config --global "" config user name
git config --global "" config email
git config --global core.editor '' config editor
cat ~/.gitconfig
git init To initialize a Git repository from an existing directory,
git add . add files
git commit -m '' commit the changes along with message.
git log list all the commits
git clone git:// clone(push) the git repo
git commit -a editor will oen for enter the commit message
git remote add origin To connect your local repository to your GitHub account, you will need to set a remote for your repo and push your commits to it:
git push origin master push the commit to the repo
git branch mybranch create a new branch
git checkout mybranch make mybranch as active
git checkout -b mybranch Creates a new branch called "mybranch" and makes it the active branch
git checkout switch between branch
git merge To merge active branch with
git branch -d to delete branch
git push origin --delete To delete remote branch i.e. from GitHub


Post a Comment

Newer Post Older Post Home