I was working on a branch on which I mistakenly did a git pull. Now there are a lot of changes on my code, but I am wondering if they are from the changes made on master or the other pull requests?
If it is from the other pull requests, please guide me on how can this be undone?
CodePudding user response:
The pull
command means run git fetch
, then run a second command to incorporate the fetched commits. The second command operates only on the current branch and uses the current branch's upstream by default, or any additional arguments you passed to git pull
.
The fetch
step is typically more interesting here. In particular, pull requests don't exist in Git. GitHub provide pull requests. GitLab provide something similar, but called merge requests. Bitbucket provide pull requests, but do some things differently from GitHub. So they're a GitHub thing in this case (you have a github tag).
When someone makes a GitHub pull request, GitHub will set up a name of the form refs/pull/number/head
. You can program Git to fetch these, but by default, Git does not fetch these. Having not fetched them in the first place, the second command that git pull
runs cannot use them.
What got into your branch depends on what arguments, if any, you gave to your git pull
command. You'll have to quote those. It may also depend on flags and/or the setup of the branch and/or your default second command for git pull
, so you should provide these as well. See also How do I ask a good question. However, there are already hundreds of answers on SO about git pull
, so by the time you figure out the right parts to put into your question—by searching SO for details you need to know about git pull
—you'll probably have found the answer to your question.