git - How do I pull files from remote without overwriting local files? -


i trying set new git repo pre-existing remote repo.

i want local files overwrite remote repo, git says first have pull remote files in , merge them.

is there way pull make sure local files not overwritten remote?

well, yes, , no...

i understand want local copies "override" what's in remote, but, oh, man, if has modified files in remote repo in different way, , ignore changes , try "force" own changes without looking @ possible conflicts, well, weep (and coworkers) ;-)

that said, though, it's really easy "right thing..."

step 1:

git stash 

in local repo. save away local updates stash, revert modified files pre-edit state.

step 2:

git pull 

to modified versions. now, hopefully, won't new versions of files you're worried about. if doesn't, next step work smoothly. if does, you've got work do, , you'll glad did.

step 3:

git stash pop 

that merge modified versions stashed away in step 1 versions pulled in step 2. if goes smoothly, you'll set!

if, on other hand, there real conflicts between pulled in step 2 , modifications (due else editing in interim), you'll find out , told resolve them. it.

things work out much better way - keep changes without real work on part, while alerting serious, serious issues.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -