-1

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!

Norbiros
  • 3
  • 3
  • what do you want to do exactly ? Ignore the other changes when you made fetch/merge – Hamza AZIZ Feb 09 '22 at 10:46
  • I created 1 thing, other people create 50. When i create PR it shows 51 changes, not 1. When i will fetching repository for for example year, it will show 601 changes. It looks like I'm adding things that other people wrote... I can not fetching my branch, but when I want to add something to new changes, i need to merge.. I want to hide this changes, because i didn't make those... – Norbiros Feb 09 '22 at 10:48

1 Answers1

0

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
Hamza AZIZ
  • 2,582
  • 1
  • 9
  • 18