Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SmartGit pull not acting like expected

Tags:

git

smartgit

I forked a repository on GitHub.

I then cloned my fork into a folder on my local development enviroment through SmartGit. Additionally I added the original repository as a remote.

Now, the original repository has added and changed some files. I'd like to retrieve these so that I'm up to date, before continuing with developing.

I the push the Pull button in SmartGit and select the original repo i the dialog. SmartGit returns this to me:

remote: Counting objects: 24, done.
remote: Total 13 (delta 7), reused 12 (delta 6)
From github.com:Original/repo
 * [new branch]      master     -> lm/master

But, the added files and changes are not added to my local repository. Doing this manually with Git Bash - git pull original master everything works like expected.

Why is it SmartGit doesn't pull like I expect?

like image 249
Repox Avatar asked May 08 '12 09:05

Repox


People also ask

How do you pull in SmartGit?

Use Remote|Pull (or the corresponding toolbar button) to invoke the Pull command. This will open the Pull dialog, where you can specify what SmartGit will do after the commits have been fetched: Merge the local commits with the fetched commits or rebase the local commits onto the fetched commits.

Does git pull make changes?

git pull, in contrast, is used with a different goal in mind: to update your current HEAD branch with the latest changes from the remote server. This means that pull not only downloads new data; it also directly integrates it into your current working copy files.

Does git pull effect remote?

The short answer is simple: no, the remote-tracking branch remains unaffected.

What does git pull F do?

The git pull command is used to fetch and download content from a remote repository and immediately update the local repository to match that content. Merging remote upstream changes into your local repository is a common task in Git-based collaboration work flows.


3 Answers

On Pull, SmartGit will perform a "git fetch" and after that merge resp. rebase the tracked branch. In your case, master tracks origin/master, not lm/master. You have following choices now, always assuming you are on master:

(1) Configure master to track lm/master instead of origin/master: invoke Branch|Branch Manager, select master, invoke Reset Tracked Branch from the context menu, then add lm/master to the selection and invoke Set Tracked Branch. Now, it's lm/master which will be merged (or rebased) on every Pull.

(2) Manually merge lm/master: invoke Branch|Merge and select lm/master.

(3) Manually rebase onto lm/master: invoke Branch|Rebase, select HEAD to selected commits and on the graph-page, select lm/master.

like image 178
mstrap Avatar answered Oct 09 '22 16:10

mstrap


What I ended up doing in SmartGit was:

  • Remote > Add (as you did). I called mine upstream.
  • In the branches panel Right click upstream > fetch more.. and select the branches. (Typically master)
  • In the branches panel Double click upstream > master. This will ask you to create a 2nd branch (usually master-2). I also called this upstream. So I have a remote repo called upstream and local branch called upstream that tracks upstream/master.
  • In the branches panel Double click Local Branches > Master to get you back to your master branch.

At this point I would presume you only just forked the project a few moments ago, so this next step would not be very useful, but if there are a few extra commits at a later stage you will need to do this.

  • Remote > Pull and select upstream. If you press the little down arrow, you will see you can ONLY do "Neither merge nor rebase". This is good.
  • Click fetch This will allow you to see all the log and what has changed.
  • In the branch panel Right click Local Branches > upstream > Merge.
  • Fast-Forward if you believe you can. (My preferred way).
  • or Create Merge-Commit.

From this point on, You would only have to do is the last 5 steps. The first steps were just setup.

like image 31
WORMSS Avatar answered Oct 09 '22 16:10

WORMSS


You would see the new files if the upstream branch of your current local branch was "lm/master".
But if you are on master, its upstream branch is certainly by default "origin/master" (ie the master of your fork)

If you want to merge the files from the original repo, complete your command with a

git merge lm/master

Or, in SmartGit, merge from lm/master to your current branch.

like image 27
VonC Avatar answered Oct 09 '22 17:10

VonC