Skip to content

Instantly share code, notes, and snippets.

@sintret
Last active March 1, 2022 20:42
Show Gist options
  • Save sintret/0e676fdaca80d6ffd4b72235be85c3c6 to your computer and use it in GitHub Desktop.
Save sintret/0e676fdaca80d6ffd4b72235be85c3c6 to your computer and use it in GitHub Desktop.
Git pull with overwrite local
DEBUG='app' pm2 start ecosystem.config.js --env production
##git merge##
git checkout master
git pull origin master
git merge test
git push origin master
##Git Reset##
git fetch --all
git reset --hard origin/master
OR
git reset --hard origin/<branch_name>
git checkout master
git branch new-branch-to-save-current-commits
git fetch --all
git reset --hard origin/master
After this, all of the old commits will be kept in new-branch-to-save-current-commits.
Uncommitted changes
Uncommitted changes, however (even staged), will be lost. Make sure to stash and commit anything you need. For that you can run the following:
git stash
And then to reapply these uncommitted changes:
git stash pop
https://stackoverflow.com/questions/1125968/how-do-i-force-git-pull-to-overwrite-local-files
#git store credentials#
git config --global credential.helper store
git pull
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment