Configure local user info:
git config --global "John Doe"
git config --global ""


Create repository:
git init --bare --shared foo.git initialized empty shared Git repository in foo.git

If you access your Git repository over http: or https: URLs
git  update-server-info

Now change group access to repository (linux)
chgrp -R <group name> foo.git


Create local repository:
git init
git add <file>
git commit -a -m 'Added something'

Then make the link to the shared repository
git remote add origin <user>@<host>:/<repository path>/foo.git

We push to the remote repository
git push origin master


Clone existing repository (ssh):
git clone <user>@<host>:/<repository path>/foo.git


Working with git:

Show local repository status
git status

Show remote branches
git branch -r

Checkout remote branch
git checkout -t origin/<branch name>

Checkout remote tag
git checkout tags/<tag_name>

Switch local branches
git checkout <branch name>

Update local branch
git pull origin <branch name>

Update remote branch with local commits
git push origin <branch name>

Commit changes in local branch
git add <file> ...
git commit -m "<message>"
or commit all modified files
git commit -a -m "<message>"

Revert local changes (reset)
git reset --soft HEAD
git reset --mixed HEAD
git reset --hard HEAD

Working with remotes
git remote

Delete tag
git tag -d 12345
git push origin :refs/tags/12345

December 1st, 2014

Posted In: tutorials


Leave a Reply