I've been using Sourcetree for a couple of weeks with great results. I have a doubt about the counts and what they really mean.
Say that I have 4 pulls to do, and uncommited files. I do the following:
After I pull my files, I have 2 push to do.. But why? Should I just be pushing my 1 commit?
Also, can I tell what files will be part of the push? I can't seem to find it anywhere.
This doesn't sound unusual at all. When you pull what actually happens (assuming you're using Git) is that it fetches the changes and merges those changes into your branch. If those pull changes conflict with some other changes you've made then it will merge them in creating a 'merge commit'. There's no indication of this visually but that's what's happened. It means a new commit will be created locally. This is quite a common thing to happen when working in teams. So technically you should be pushing two commits in that case.
As for telling which files will be part of the push, one way to find this out is to look at the ahead count in the log view, then select the commits (use shift) which will be pushed, then look at the file changes in the log view to see what will get pushed.
You can see from this image that the entire branch is new as it's "2 ahead".
Hope that helps, feel free to ask more questions if you need.
Thanks.. That doesn't quite make sense in my scenario, I only have 1 file that I am working on.. So when I pull I expect the other files in my local to now be up to date and only one file changed(the one I'm working on).. Why would I have more than one push since I'm essentially up to date with the repo except this one file?
No, there were no changes to that file.. What's even stranger is that it went from 1 push to 3 in this scenario..
I'll see if I can get better details next time since you pointed out how I can tell what has changed. Maybe if I don't do a automatic commit I can figure out exactly what it's doing.
So I juist tried this. I did a commit on multiple files, at this point I have 1 pull and 1 push.
I confirmed the files to be pulled were not files I have changed, I pulled with commiting, and I can see these are two files I did not touch. So when I commit i expect these two files to now be up to date with the repo.
Once I commit, I see two push. Now, why do I have a second push for this commit that I just made? If this commit essentially brings these 2 files up to date with the repo. What exactly am I pushing, the same 2 files again? even though I'm not making changes to them?
For what it is worth, I am having the same trouble in understanding how this works. I can't push my commits until I pull everything that changed on the remote branch. However, this creates an additional merge, and commit even though nothing in the list of pulled files conflicts with what I changed locally. So whenever I pull in changes while working on something else, I always end up having to do a merge and additional commit for changes to files that I never made, and that do not conflict with anything that I have done. That seems counterintuitive to me.
Merge commits are created because there's two separate lines of development which are on the same branch. A merge happens even if there's no conflicts if there are changes to pull before you've pushed yours. Your history has diverged as a result and so the two lines of development need to merge together. There might not be any conflicts at all, the merge commit will determine this and you'll be prompted for the necessary action if so.
The merge commit then can allow you to go through the merge process and thus resolve any conflicts if any. There may be no conflicts at which point a merge commit just gets created automatically.
If you want to avoid this from happening then you need to make sure you auto-rebase the changes when pulling in a diverging line of development. In SourceTree the default setting is to rebase rather than merge. In the pull sheet there's a checkbox that says "Rebase instead of merge". If this isn't checked then it'll create a merge commit when pulling down changes if the lines of development have diverged.
It can seem confusing if you use this option, because the question is 'why did you have to create that commit?'. The answer is that it didn't, it's just your Git settings will cause an explicit merge commit to be created so it's clear that the two lines of development merged together. Some teams like to know this as it's very important to know that multiple people were working on the same branch at the same time as the only other way to tell is by looking at the commit dates and noticing they're not in date order (out-of-order commits).
Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG