I tried to pull remote branch to my local machine, but it did not get updated locally. Tyring to resolve this issue.
$git pull origin
$git branch -a
I was on master branch locally.
$git diff membership_module origin/membership_module
The above shows that local branch is different than the remote branch.I was expecting no changes in local and remote branches after a pull.
$git pull origin membership_module:membership_module
Now it shows error as non-fast-forward
! [rejected] membership_module -> membership_module (non-fast-forward)
How do I solve this?
Now I tried to switch to that branch.
$git checkout membership_module
I tried to pull again.
$git pull origin membership_module:membership_module
same error ! [rejected] membership_module -> membership_module (non-fast-forward)
So I tried following
$git pull --verbose
Now it shows useful information.
= [up to date] membership_module -> origin/membership_module
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> membership_module
The above is useful.
Now I tried following:
$git branch --set-upstream-to=origin/membership_module membership_module
$git pull origin membership_module
* branch membership_module -> FETCH_HEAD
Auto-merging npo_plaza/db/seeds.rb
CONFLICT (content): Merge conflict in npo_plaza/db/seeds.rb
Auto-merging npo_plaza/db/schema.rb
CONFLICT (content): Merge conflict in npo_plaza/db/schema.rb
Auto-merging npo_plaza/config/application.rb
CONFLICT (content): Merge conflict in npo_plaza/config/application.rb
Auto-merging npo_plaza/app/models/ticket_type.rb
Auto-merging npo_plaza/app/models/client.rb
Auto-merging npo_plaza/app/constants/enums.rb
CONFLICT (content): Merge conflict in npo_plaza/app/constants/enums.rb
Automatic merge failed; fix conflicts and then commit the result.
Then I did git status.
$git status
It showed several new files added and following 4 files which I will have to merge manually.
Unmerged paths:
(use "git add <file>..." to mark resolution)both modified: npo_plaza/app/constants/enums.rb
both modified: npo_plaza/config/application.rb
both modified: npo_plaza/db/schema.rb
both modified: npo_plaza/db/seeds.rb
I will have to manually merge these 4 files and then add then to git repository.
$git add .
$git commit -m "Membership module development"
$git push origin
This resolved the issue of code mismatch between local branch and remote branch.