Github Fetch and Merge problems

178 Views Asked by At

I forked github repository month ago. I created branch "test".

Yesterday I opened it on GitHub (page) and I clicked "Fetch and Merge" button (on branch "test"), after that I updated branch with some changes. Later I created PR to origin repository. When I opened PR page it shows my change and also other's people changes that was added to my repository when I fetched code!

Also test "Prettier" returned this errors:

fatal: You are not currently on a branch.
To push the history leading to the current (detached HEAD)

In this PR I created only one change but it shows 50... I don't want that. Can someone help me?

I was trying a lot of things on Youtube, Stackoverflow but still I can't fix it!

1

There are 1 best solutions below

0
Hamza AZIZ On

Okay

if you're working with other people in the same project, there are two things that you have to consider before pushing your changes to the remote repository

you need to have the latest changes made by others to be in your local repository (or forked one), so when you push yours, there will be no conflicts, otherwise Git will not let you push to the remote repo unless you force the push by the flag -f, which is not recommended because it will make conflicts for other peoples

so you need to fetch/merge, and then push, and when you'll make a pull request to the repo, this will just show the changes you made, not other's changes because they are already in the remote repo

so

git pull 

solve conflicts if you find them and then

git push