Useful git commands

19 Jul

Useful git commands

#remove files only from local, not from git
$git rm -r --cached myfolder/

#reset back to the head
$git reset --hard my_branch

#make a branch same as master
$git checkout -B new master

#Delete local branch
$git branch -d branch_name

#delete a remote branch
git push origin --delete branch_name

#push a new local branch to remote
$git push -u origin my_branch

#ignore file mode change
$git config core.fileMode false

#Fetch a remote branch
$git fetch
$git checkout new_branch

Leave a Reply

Your email address will not be published. Required fields are marked *