Questions tagged [git-pull]

Fetches changes from a remote repository and incorporates them into the current branch of a Git repository.

git pull is used whenever changes from a remote repository need to be fetched and incorporated into the local repository. Internally git pull first performs a git fetch to get the remote branches updated and then a git merge to incorporate the changes into the current branch.

1231 questions
360
votes
5 answers

Difference between git pull and git pull --rebase

I started using git sometime back and do not fully understand the intricacies. My basic question here is to find out the difference between a git pull and git pull --rebase , since adding the --rebase option does not seem to do something very…
Rndm
  • 6,710
  • 7
  • 39
  • 58
338
votes
21 answers

git pull error :error: remote ref is at but expected

Full message: error: Ref refs/remotes/origin/user is at 3636498c2ea7735fdcedc9af5ab3c8689e6abe77 but expected a21359c6cc2097c85775cde6a40105f4bd7100ec From github.com:{github project url} ! a21359c..6273ffc user -> origin/user (unable to update…
Sanjeev Kumar Dangi
  • 6,925
  • 7
  • 28
  • 30
334
votes
2 answers

What is the difference between git pull and git fetch + git rebase?

Another question says that git pull is like a git fetch + git merge. But what is the difference between git pull and git fetch + git rebase?
michael
  • 106,540
  • 116
  • 246
  • 346
333
votes
2 answers

Resolve conflicts using remote changes when pulling from Git remote

I'm trying to pull code from my GitHub repo onto my server, but the pull keeps failing because of merge conflicts. I don't want to keep any of the changes that may have occurred on my local server since the last pull. So is there a way I can force…
David Tuite
  • 22,258
  • 25
  • 106
  • 176
312
votes
12 answers

Why does git say "Pull is not possible because you have unmerged files"?

When I try to pull in my project directory in the terminal, I see the following error: harsukh@harsukh-desktop:~/Sites/branch1$ git pull origin master U app/config/app.php U app/config/database.php U app/routes.php Pull is not possible because you…
Harsukh Makwana
  • 4,296
  • 3
  • 27
  • 34
290
votes
8 answers

What does FETCH_HEAD in Git mean?

git pull --help says: In its default mode, git pull is shorthand for git fetch followed by git merge FETCH_HEAD. What is this FETCH_HEAD and what is actually merged during git pull?
Misha Moroshko
  • 166,356
  • 226
  • 505
  • 746
243
votes
25 answers

Password authentication is temporarily disabled as part of a brownout. Please use a personal access token instead

I was using a username password for pushing my code. It was working for several months, but suddenly I'm not able to do it and am getting this error: Username for 'https://github.com': shreyas-jadhav Password for…
Shreyas Jadhav
  • 2,363
  • 4
  • 10
  • 23
243
votes
7 answers

Is it possible to pull just one file in Git?

I am working on a Git branch that has some broken tests, and I would like to pull (merge changes, not just overwrite) these tests from another branch where they are already fixed. I know I can do git pull origin that_other_branch but this will…
Audrius Meškauskas
  • 20,936
  • 12
  • 75
  • 93
232
votes
7 answers

How do I force git pull to overwrite everything on every pull?

I have a CENTRAL bare repository that has three developer repositories pulling and pushing to it normally. I also have two other repositories that pull from the CENTRAL bare repo: one is the live server, and the other is a test/stage server—each…
bmilesp
  • 2,559
  • 3
  • 16
  • 14
230
votes
31 answers

GitHub - fatal: could not read Username for 'https://github.com': No such file or directory

I have the following problem when I try to pull code using git Bash on Windows: fatal: could not read Username for 'https://github.com': No such file or directory I already tried to implement the accepted solution provided here: Error when push…
noobie-php
  • 6,817
  • 15
  • 54
  • 101
217
votes
1 answer

Difference between git pull --rebase and git pull --ff-only

Let's say origin/master has commit A--B--C and my local/master has commit A--B--D. What will happen if I use git pull --rebase ? What will happen if I use git pull --ff-only ? Is there any difference in the resulting commit tree ?
Nico
  • 6,395
  • 4
  • 25
  • 34
180
votes
10 answers

Git: How to pull a single file from a server repository in Git?

I am working on a site with a server running Git. I am using Git for deployment (not GitHub). This was set up prior to my involvement using a hook method, and I referred to this question and entered the commands below, but it didn't work. How do I…
vsvs
  • 1,975
  • 2
  • 12
  • 14
176
votes
5 answers

Can "git pull" automatically stash and pop pending changes?

I know how to solve this: user@host$ git pull Updating 9386059..6e3ffde error: Your local changes to the following files would be overwritten by merge: foo.bar Please, commit your changes or stash them before you can merge. Aborting But isn't…
guettli
  • 25,042
  • 81
  • 346
  • 663
159
votes
3 answers

Why is git prompting me for a post-pull merge commit message?

Recently, following any git pull, git has started spawning my text editor, and asking for a merge commit message. A commit message is already pre-filled, and I just have to save and close the window to complete the pull. In the past, it would do the…
shanebonham
  • 2,219
  • 2
  • 18
  • 19
155
votes
8 answers

Trying to pull files from my Github repository: "refusing to merge unrelated histories"

I'm learning git, and I'm following the Git community book. Previously (long time ago) I made a public repository on Github, with some files. Now I set up a local Git repository on my current computer, and committed some files. Then I added a…
MichaelSB
  • 3,131
  • 3
  • 26
  • 40
1
2
3
82 83