git pull origin master Username for 'https://github.com': username Password for 'https://username@github.com': remote: Enumerating objects: 28, done. remote: Counting objects: 100% (28/28), done. remote: Compressing objects: 100% (19/19), done. remote: Total 24 (delta 11), reused 16 (delta 3), pack-reused 0 Unpacking objects: 100% (24/24), done. From https://github.com/username/ReactProj * branch master -> FETCH_HEAD 3f77fdf3..3edcabe1 master -> origin/master error: Your local changes to the following files would be overwritten by merge: package-lock.json package.json src/index.js yarn.lock Please commit your changes or stash them before you merge. Aborting
Linux* gitlabLinux DistributionsWeb Servers
Last Comment
David Favor
8/22/2022 - Mon
rindi
This happens if you download to the same location as you have done previously and have already worked with. I would download to a new location.
chalie001
ASKER
I what to overwrite local work
rindi
Then just delete the the directory before downloading. Or I usually rename the directory just in case I need it again or want to compare something.
$ git pull Username for 'https://github.com':user Password for 'https://user@github.com': You are not currently on a branch. Please specify which branch you want to merge with. See git-pull(1) for details.
1) First do a clone into a directory... only once, you never do 2x clones...
2) Then to overwrite local work, cd to the directory + do a git pull, which will pull down all changes to repository.
3) If what you're asking is how to overwrite any changes you've made, revering to original repository files, the easy + foolproof solution is to destroy the entire directory, then do a git clone again.
You can... attempt to overwrite selective files, except this process is complex + error prone.