question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pulling repo only pulls current branch

See original GitHub issue

Description

Version

  • GitHub Desktop: 1.5.0
  • Operating system: MacOS Mojove 10.14.1

Steps to Reproduce

  1. Check out a different branch, e.g. switch from repo/branch-1 to repo/branch-2
  2. Make changes to the previously checked out branch, e.g. repo/master, from a different source (like adding commits or deleting the branch)
  3. Pull repo in Desktop via Repository > Pull or Shift + Command + P

Expected Behavior

All branches should be pulled.

Actual Behavior

Only the current branch is pulled.

Additional Information

I believe this issue was not present in a present in previous versions of Desktop.


Commits added to the branch not checked out, e.g. branch-1, are not reflected in Desktop after pulling the repository via above steps, so for example attempting to merge from that branch into, say, branch-2 may yield branch-2 is up-to-date” when in fact it is not. The workaround in this case is to stash any staged/unstaged changes, check out branch-1, pull, return to branch-2, and merge.

Checked out branch staging has additional commits on remote image

Check out branch conflicts-expansion and pull from remote image

Attempt to merge from staging into conflicts-expansion image

After switching to staging, pulling, then switching back to conflicts-expansion image


If, say, branch-2 is deleted, it is still in Desktop (on the local machine) and commits can be added. When attempting to pull while this branch is checked out, a modal says, “Your configuration specifies to merge with the ref ‘refs/heads/branch-2’ from the remote, but no such ref was fetched.” Desktop does recognize the branch was deleted as it does give the option to publishbranch-2.

A deleted branch is checked out image

Attempting to pull from a deleted branch image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ezracellicommented, Nov 28, 2018

I wouldn’t call it disruptive, as there is a workaround (stash, switching, pulling, switching, stash pop), but it can be troublesome if you think you’re up to date and you’re not. It’s really more of an annoyance than anything else.

Take the example I used above.

X-X-X-X-Y            staging
       \-X-X-X-X     conflicts-expansion

Say someone working on staging mentioned to me that they fixed a bug, adding the commit Y. I (still in conflicts-expansion) pull and merge from staging into conflicts-expansion and see the bug is still there — because commit Y was never actually pulled, but there is no indication in Desktop. They try to reproduce the issue and can’t. Finally I check out staging and see that there is an unpulled commit.

0reactions
stevewardcommented, Feb 24, 2021

@ezracelli I’m going to close this out due to inactivity. It looks like this specific case is the same as your request (fetching changes to ensure branches are up-to-date when performing a merge). You can follow https://github.com/desktop/desktop/issues/10687 for updates about that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can you git pull only the current branch? - Stack Overflow
Git already only pulls the current branch. If you have branch set up as a tracking branch, you do not need to specify...
Read more >
git-pull Documentation - Git
Incorporates changes from a remote repository into the current branch. If the current branch is behind the remote, then by default it will...
Read more >
Git Pull Explained - freeCodeCamp
By default, git pull does two things. 1. Updates the current local working branch (currently checked out branch)
Read more >
Difference between 'git pull' and 'git fetch' | by Aram Koukia
In other words: git pull will always merge into the current branch. So you select which branch you want to pull from, and...
Read more >
Learn how to pull from a remote branch in Git - GitKraken
Git Pull Fast-Forward Only. If a merge is not required, Git will fast forward your local branch. This means that your local branch...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found