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.

1172 questions
13368
votes
38 answers

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

What are the differences between git pull and git fetch?
pupeno
  • 271,514
  • 122
  • 354
  • 592
8913
votes
47 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
  • 94,151
  • 10
  • 39
  • 52
1758
votes
29 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
  • 19,379
  • 6
  • 28
  • 44
1206
votes
46 answers

Message "Support for password authentication was removed. Please use a personal access token instead."

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. Please use a personal access token instead. remote: Please see…
Daemes
  • 10,959
  • 3
  • 4
  • 10
1067
votes
16 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
  • 41,094
  • 14
  • 84
  • 139
873
votes
16 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
  • 62,655
  • 58
  • 229
  • 366
858
votes
16 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
  • 10,781
  • 7
  • 28
  • 55
805
votes
38 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,088
  • 8
  • 31
  • 43
786
votes
18 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
  • 10,597
  • 3
  • 30
  • 45
653
votes
14 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
  • 130,366
  • 27
  • 54
  • 71
459
votes
4 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
  • 28,411
  • 18
  • 86
  • 126
431
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
  • 48,919
  • 20
  • 87
  • 96
356
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,610
  • 7
  • 38
  • 58
349
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
  • 7,907
  • 8
  • 39
  • 74
328
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
  • 21,708
  • 25
  • 98
  • 175
1
2 3
78 79