Some useful git command with branches and remote repositories.
git remote -v
Add remote gitosis server:
git remote add <remote_name> email@example.com:my_project_name.git
git push <remote_name> master
Where master is your branch name
Main git branch orperations
git branch -v
-v is optional, you use it to get more verbose output
Create new branch:
git checkout -b <new_branch_name>
git checkout <a_branch>
git commit -am 'I did something'
git checkout <b_branch>
git merge <a_branch>
git branch -d <branch_name>
Reset an old commit state
Warning: you always clone your repository before try these commands!
You can undo everything you've made since last commit. Uncommited modifications will be lost.
git reset --hard HEAD
Remove the last 3 commit. Commits will be removed from git forever:
git reset --hard HEAD~3
Undo uncommited changes for a specified file:
git checkout -- <file_name>