Back to GitBack to LinuxBack to Ubuntu

Git,Linux,Ubuntu

git commands

Author

Anjani Phuyal

Date

May 26, 2014

Category

Git, Linux, Ubuntu

Read Time

6 min read

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?: http://stackoverflow.com/questions/927358/how-to-undo-the-last-git-commit

http://stackoverflow.com/questions/927358/how-to-undo-the-last-git-commit?lq=1

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
#Git#Linux#Ubuntu