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
username and password
git status
git remote show origin
git remote -v
git pull origin master
git add host-monitor
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
Then you’re free to:
git config –global –add <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.
git revert –no-commit Y git revert –no-commit X git commit -m “the commit message” git push   ref:   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