How to create a new git branch and push it?

  • git checkout -b new_branch_name
  • git push -u origin new_branch_name
   
git clone https://github.com/IAT/systems-iat-automation.git
username and password
git status
git remote show origin
git remote -v
git pull origin master
git add host-monitor hostupdate.sh
git commit -am “hostupdate”
git push origin master
git fetch
git config –l
git config –global –list
You can edit the ~/.gitconfig file in your home folder. This is where all --global settings are saved.
git config --global --unset-all user.name
Then you’re free to:
git config –global –add user.name <whatever>
vi ~

How to undo the last Git commit?

git reset –soft HEAD^
How to revert the multiple git commits?
I have a git repository that looks like this:
X -> Y -> HEAD
I want the head of the branch to point to X.
Solution:
git revert –no-commit Y git revert –no-commit X git commit -m “the commit message” git push   ref: http://stackoverflow.com/questions/1463340/revert-multiple-git-commits   git remote branch deleted but still appears in ‘git branch -r’
  • git remote prune origin
  Clean up multiple test commits
  • git rebase -i {commithash}
  • sqash
  • git push –force