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
13671
votes
37 answers

What is the difference between 'git pull' and 'git fetch'?

What are the differences between git pull and git fetch?
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
9414
votes
52 answers

How do I force "git pull" to overwrite local files?

How do I force an overwrite of local files on a git pull? My local repository contains a file of the same filename as on the server. error: Untracked working tree file 'example.txt' would be overwritten by merge
Jakub Troszok
  • 99,267
  • 11
  • 41
  • 53
1846
votes
30 answers

Git push requires username and password

I cloned a Git repository from my GitHub account to my PC. I want to work with both my PC and laptop, but with one GitHub account. When I try to push to or pull from GitHub using my PC, it requires a username and password, but not when I'm using…
TooCooL
  • 20,356
  • 6
  • 30
  • 49
1532
votes
49 answers

Message "Support for password authentication was removed."

I got this error on my console when I tried to use git pull: remote: Support for password authentication was removed on August 13, 2021. remote: Please see…
Daemes
  • 14,239
  • 3
  • 6
  • 13
1195
votes
33 answers

How can I deal with this Git warning? "Pulling without specifying how to reconcile divergent branches is discouraged"

After a git pull origin master, I get the following message: warning: Pulling without specifying how to reconcile divergent branches is discouraged. You can squelch this message by running one of the following commands sometime before your next…
Davide Casiraghi
  • 15,591
  • 9
  • 34
  • 56
1112
votes
17 answers

Update Git submodule to latest commit on origin

I have a project with a Git submodule. It is from an ssh://... URL, and is on commit A. Commit B has been pushed to that URL, and I want the submodule to retrieve the commit, and change to it. Now, my understanding is that git submodule update…
Thanatos
  • 42,585
  • 14
  • 91
  • 146
921
votes
17 answers

There is no tracking information for the current branch

I've been using github from a relatively short period, and I've always used the client to perform commits and pulls. I decided to try it from the git bash yesterday, and I successfully created a new repo and committed files. Today I did changes to…
valerio0999
  • 11,458
  • 7
  • 28
  • 56
884
votes
17 answers

Rename master branch for both local and remote Git repositories

I have the branch master which tracks the remote branch origin/master. I want to rename them to master-old both locally and on the remote. Is this possible? For other users who tracked origin/master (and who always updated their local master branch…
Albert
  • 65,406
  • 61
  • 242
  • 386
867
votes
39 answers

How do I ignore an error on 'git pull' about my local changes would be overwritten by merge?

How do I ignore the following error message on Git pull? Your local changes to the following files would be overwritten by merge What if I want to overwrite them? I've tried things like git pull -f, but nothing works. To be clear, I only want to…
mae
  • 14,947
  • 8
  • 32
  • 47
844
votes
20 answers

Merge, update, and pull Git branches without using checkouts

I work on a project that has 2 branches, A and B. I typically work on branch A, and merge stuff from branch B. For the merging, I would typically do: git merge origin/branchB However, I would also like to keep a local copy of branch B, as I may…
charles
  • 11,212
  • 3
  • 31
  • 46
718
votes
17 answers

How to `git pull` while ignoring local changes?

Is there a way to do a git pull that ignores any local file changes without blowing the directory away and having to perform a git clone?
markdorison
  • 139,374
  • 27
  • 55
  • 71
509
votes
5 answers

Git pull after forced update

I just squashed some commits with git rebase and did a git push --force (which is evil, I know). Now the other software engineers have a different history and when they do a git pull, Git will merge. Is there a way to fix this, except doing a rm…
iblue
  • 29,609
  • 19
  • 89
  • 128
437
votes
5 answers

In what cases could `git pull` be harmful?

I have a colleague who claims that git pull is harmful, and gets upset whenever someone uses it. The git pull command seems to be the canonical way to update your local repository. Does using git pull create problems? What problems does it create?…
Richard Hansen
  • 51,690
  • 20
  • 90
  • 97
390
votes
7 answers

How to pull remote branch from somebody else's repo

I've got a project hosted on GitHub which somebody has forked. On their fork, they've created a new branch "foo" and made some changes. How do I pull their "foo" into a new branch also named "foo" in my repo? I understand they could submit a pull…
Colin O'Dell
  • 8,386
  • 8
  • 38
  • 75
388
votes
5 answers

How to 'git pull' without switching branches (git checkout)?

I'm used to running git pull and other commands from within a branch I'm working on. But I have set up a development server that several people work on, so I don't want to have to switch branches when I do it. If I want to update an existing branch…
Diana Saunders
  • 3,889
  • 2
  • 12
  • 3
1
2 3
82 83