Git force overwrite of local tracked files but not local untracked files -
i working in local directory named p1
contains git repo. after adding branch , making commit on added branch, made copy of directory p1
, called p2
. intention play around merging , rebasing (just learn) in directory p2
, while pushing remote repo p1
when determined how wanted merge/rebase changes.
however, accidentally did merging , pushed remote repo p2
directory. ok, because remote repo has correct state of git project.
however, need replace what's in directory p1
what's in remote repo. way, directory p1
up-to-date.
when go directory p1
, try pull remote repo, here get:
git pull updating e07d50d..287ec08 error: local changes following files overwritten merge: debug/external/subdir.mk debug/makefile debug/subdir.mk input/parameters.cfg main.cpp please, commit changes or stash them before can merge. aborting
now, have found potential solutions problem, such this.
the problem in case, however, directory p2
contains untracked files not want deleted when pull remote repo.
so, how can pull remote repo, overwriting local tracked files, without deleting local untracked files?
note: 1 of answers here seems appropriate me, i'm not 100% certain.
git fetch git reset --hard origin/master
Comments
Post a Comment