1

i have a bash script:

cd ~/www/myprj
pwd
git pull https://usr:psw@bitbucket.org/myusr/myprj.git 
git checkout branch2
git log --oneline -n 15 --pretty=format:'%h %ar [%ai] (%ae) %s' --date=short origin/branch2

which i used to run from a php script using:

<?php system("bash ~/private/pull.sh"); ?>

I used it to pull all changes from a remote bitbucket repository and updated development version of the project. However, since recently it stopped working. After trying to trace the problem and running the commands from the terminal I found that the git pull is trying to merge the latest commits although there are no local changes?

Any idea of how can I just force the git pull and ignore local changes? or is there any other way to pull the changes without merging?

i tried git pull --no-edit but it didn't help me

phd
  • 69,888
  • 11
  • 97
  • 133
  • so you wanna ignore all the local change for that branch? Is it possible for you to do something like `git fetch` first, and then `git checkout branch2`, and then `git reset --hard origin/branch2` – Adrian Shum Apr 23 '19 at 04:01
  • Adrian, it doesn't pull the latest commits from the remote repository – Kiril Zvezdakoski Apr 23 '19 at 04:08
  • Check this out: https://stackoverflow.com/questions/34526346/git-pull-asks-me-to-write-merge-message – Cyro Dubeux Apr 23 '19 at 04:13

1 Answers1

0

Check first on which branch you are when doing a git pull, in order to make sure the merge step is trying to merge the expected branch.

See also your git config --local -l to check how the branches are declared/merged.
Or if you have directives like git config core.autocrlf, which could introduce local changes automatically.

Then, as a workaround/test, try and clone the repository again in a new folder, and see if the issue persist in that new cloned repo.

VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755