GIT – Useful configuration orders

Git Configurations

Remove all your local git branches, use master instead

git branch | grep -v "master" | xargs git branch -D 

Add remote repository

git remote add remote_name https://github.com/moodle/moodle
//view all remotes
git remote -v

Remove Remote

git remote rm remote_name

Save custom user credential git repositories

git config --global credential.helper 'cache --timeout=3600000000000'

Git ignore for file mode

git config core.fileMode false

How to push branch to remote repository

git push remote_name branchnew:branchnew

Update new repository url

git remote set-url origin https://github.com/moodle/moodle

Reset all changes 

git reset --hard

Prune ALL BRANCHES

git remote prune origin

Compare branches

git log yorebranch MOODLE_39_STABLE --oneline --no-merges

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.