I have some local changes and I know the repo has moved ahead since my last pull. When I do git pull, i get below message -
$ git pull Enter passphrase for key '/c/Users/xxx/.ssh/id_rsa': remote: Counting objects: 65, done. remote: Compressing objects: 100% (53/53), done. remote: Total 65 (delta 29), reused 0 (delta 0) Unpacking objects: 100% (65/65), 16.35 KiB | 7.00 KiB/s, done. From bitbucket.org:abc/someproject ashljkl..db9e852 feature/somefeature -> origin/feature/somefeature error: Your local changes to the following files would be overwritten by merge: src/main/java/com/somefilepath Please commit your changes or stash them before you merge. Aborting Updating ashljkl..db9e852 From this SOF post: How do I ignore an error on 'git pull' about my local changes would be overwritten by merge? I could figure out how to resolve this issue. 1) git stash local change 2) git pull 3) then git stash pop the stashed changes.
But I want to know if there is an further easier way of handling this - just say to git pull with some options/flags to merge the changes from repo with my local changes directly. In the process of merging, if there are conflicts, i am fine with git showing conflicts and placing conflict markers in the source files that have conflicts.
git pull --autostashwill stash your local changes and pull in new changes. not sure if there are any options thing that will merge automatically with a pull. In any case git seems to complain of a conflict during merge.