youngmon/atlassian-qna huggingface dataset:
Why does SourceTree automatically update my ~/.gitconfig file
Asked by Ankush Agarwal:

Whenever I open SourceTree, it adds the following lines to my \~/.gitconfig file :

\[difftool "sourcetree"\]

cmd = opendiff \\"$LOCAL\\" \\"$REMOTE\\"

path =

\[mergetool "sourcetree"\]

cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \\"$LOCAL\\" \\"$REMOTE\\" -ancestor \\"$BASE\\" -merge \\"$MERGED\\"

trustExitCode = true

I don't want it to do that


Answers:
author: Bal?zs Szakm?ry
body: In Tools/Options ("General" tab), on the top left, there is a checkbox: "Allow SourceTree to modify my global Git and Mercurial config files". If you uncheck this, it will stop doing it.

comments: author: Ankush Agarwal
body: Got it. Thanks!


author: Mateusz Loskot
body: [@Ankush Agarwal](/t5/user/viewprofilepage/user-id/674356)asked *Why SourceTree modifies the file?*

It would be good to understand why too, not just how to prevent it.


author: DragonFyre
body: This seems to still be an issue or one that has resurfaced. I have sourcetree version 3.2.6 and I have unchecked that option and every time I exit the options page it automatically updates my gitconfig to blank out the difftool and mergetool cmd lines even it I'm not on the diff option tab. It only shows "system default" in the diff option tab, but it is not selectable to set it to my user installed preferred version of beyond compare (in appdata folder).
Pushing a branch to a remote server fails
Asked by Isuru:

I have a project which uses Git on a remote server. I installed SourceTree for Mac to manage it. I also have a .ssh folder with the private in the root directory where I keep all my projects and the public key is in the server.

I was able to clone the project successfully and even commit+push it back with no problem. Then I ceated a branch in my local repo, added a new file and tried commit+push it. It was committed but the pushing failed with the following error message.

**Pushing to git@gitserver:gitbtest**

**ssh: Could not resolve hostname gitserver: nodename nor servname provided, or not known**

**fatal: Could not read from remote repository.**

**Please make sure you have the correct access rights**

**and the repository exists.**

I'm not sure why this is happening. Is there a way to set SSH keys in SourceTree for Mac? I can't seem to find any option to do so.

Any help to resolve this would be great.

Thank you!


Answers:
author: Seth
body: The key message here is "**ssh: Could not resolve hostname gitserver: nodename nor servname provided, or not known** ". <http://bit.ly/1tqBEgl>


Tags: mac
Reset Head in Source Tree?
Asked by OC2PS:

Ok, I did something stupid.

I have forked a repo on Github. I made some changes, commited them into one commit, pushed that to my fork, and then on Github I created a pull request for the project owner (upstream).

Only, the project owner rightly rejected the commit as it is practically incomprehensible. What I should have done is broken down the diff into 6 different bite-sized commits.

So, I'd like to fix this now. I'd like to revert my last commit. I don't want to lose the changes - just to uncommit them, so that I can pick and choose the changes I want to include in new, smaller commits.

Can Sourcetree help me with that?


Answers:
author: Bal?zs Szakm?ry
body: 1. Right-click on the last good commit (the one before the one you need to take into pieces).
2. Select "Reset current branch to this commit".
3. In the dialog that comes up, select the "Soft" option.

This will turn all commits above the reset point into uncommitted changes and you can commit them again as needed. (Afterwards, you will need to force push the results, because you are going to rewrite history.)

comments: author: OC2PS
body: It's you again Balazs! Thanks, you are a life saver.

Question: Would right-clicking the wrong commit and choosing Reverse Commit also have the same effect?


author: Bal?zs Szakm?ry
body: :)

Reverse commit creates a commit which has the opposite of the changes of the original one, so that they "cancel out" in the end. It will put the latest state of the repo back to where it was, but you will not have the changes in the working copy to commit again.

If you create a second clone, you can also check out the current head in both, revert the commit in the first, copy over the changed files from the second to the first and then commit the changes in the first, on top of the revert. This spares you the force push in the end, but it is a bit more tedious.


author: Bal?zs Szakm?ry
body: As far as I know, you cannot force push from SourceTree, you have to do it from the command line:

```
git push origin --force
```


author: OC2PS
body: Ok, I managed to get the working copy right. (reset to the commit previous to this patch). How do I force push to github so that my fork on github goes back to this as well? At the moment, my local repo is (obviously) one commit behind the github origin.
Stash integration with IDE
Asked by rahuldanwade:

can I interate Stash or Sourcetree with IDE : Keil compiler, Visual Studio, OpenICE, IAR IDEs

Is any connector or something available in market free or paid??


Answers:
author: Bal?zs Szakm?ry
body: Most IDE's have built-in Git integration, but as far as I know, SourceTree is the only thing that integrates with the additional features (=pull requests) of Stash.

In Visual Studio, the Microsoft Git Provider is part of the main program since the 2013 version and installable as an [add-on for 2012](http://visualstudiogallery.msdn.microsoft.com/abafc7d6-dcaa-40f4-8a5e-d6724bdb980c). (Not sure about the other IDE's you mentioned.)


Tags: bitbucket-server
How to ignore remote branches
Asked by Pavel Kou?il:

Hello,  

I would like to ask one thing -- how can one ignore some of the remote branches? I don't want to delete them, just ignore them for the Log/History view.

Unfortunately, my hosting which supports git deploy, has some weird setup where remote = domain and respective branches are subdomains, therefore having some of these branches in the view clutters it with totally unrelated project.  

Is it even possible?  
Thanks in advance!

<br />


Answers:
author: Bal?zs Szakm?ry
body: Above the commit history, there is a "Show Remote Branches" checkbox. If you clear that, only local branches are displayed.

comments: author: Bal?zs Szakm?ry
body: There is no option to do that. You might want to try Git Extensions, it has a more sophisticated branch filter.


author: Pavel Kou?il
body: Well, I need to ignore only specific branches from one remote, not all remote branches.


Tags: moderators
external diff from log selected window
Asked by Robin Weiss:

Trying to use an external diff tool from within the "log selected" window but option is not available. Have set up my external diff tool and it works without issue.

In windows implementation of sourcetree we get the following from the log window:

![](../../upfiles/windows.png)

In mac we get the following in the log window:

![](../../upfiles/mac.png)

Also, the external diff menu option from the actions menu is disabled when in this view.

Workaround clearly is to open both of the commits and then toss them into my diff tool. What is the best way to send two arbitrary commits of a specific file into an external diff tool within sourcetree on mac?


Answers:
author: Seth
body: SourceTree does not allow you to diff arbitrary commits with each other on any OS. In Windows (where you appear to have the option), you'll find that actually using the external diff will compare the commit you right-clicked on (regardless of other commits in your selection) with your working copy.

The Mac interface is probably slightly better in this respect, as it doesn't imply that you are using a feature that isn't there.
warning: bitbucket.org certificate with fingerprint 45:ad:ae:1a:cf:0e:73:47:06:07:e0:88:f5:cc:10:e5:fa:1c:f7:99 not verified
Asked by Aleksey Kostin:

Hello!

I've just installed the SourceTree, but when cloning my repo, I get error.

```
hg clone https://ostin654@bitbucket.org/justclickru/trunk /Users/kostin/hg/trunk warning: bitbucket.org certificate with fingerprint 45:ad:ae:1a:cf:0e:73:47:06:07:e0:88:f5:cc:10:e5:fa:1c:f7:99 not verified (check hostfingerprints or web.cacerts config setting)
```


Answers:
author: Seth
body: [](/questions/241767/check-hostfingerprints-warnings)<https://answers.atlassian.com/questions/241767/check-hostfingerprints-warnings>

[](/questions/216065/bitbucket-not-pushing)<https://answers.atlassian.com/questions/216065/bitbucket-not-pushing>

comments: author: Aleksey Kostin
body: First link helped
Everytime I try to amend a commit on windows with interactive rebase it aborts
Asked by Tim Schroeder:

I am trying to amend a commit. I right-click the commit before it. I select rebase children. Then I select amend commit. Once I click ok it shows that it's ready to go. Then I click ok and then it aborts the rebase. Here are the two log messages:

First Message:

```
git -c diff.mnemonicprefix=false -c core.quotepath=false -c "sequence.editor='C:\Program Files (x86)\Atlassian\SourceTree\stree_gri'" -c "core.editor='C:\Program Files (x86)\Atlassian\SourceTree\stree_gri'" rebase -i --autosquash a64656091c10d4a31e434bb93118f1ee3ff45a7fRebasing (1/11)Stopped at 34b37ad... Cleanup AttributesYou can amend the commit now, with	git commit --amendOnce you are satisfied with your changes, run	git rebase --continueCompleted successfully.
```

After I click close to begin my rebase it says:

```
git -c diff.mnemonicprefix=false -c core.quotepath=false rebase --abortCompleted successfully.
```

This only shows with full output on. If I turn that off it does the same thing I just have no interaction it just returns me back to the original point I was at.


Answers:
author: Alex Jennes
body: I'm experiencing the same issue. I don't know if this is a workaround or is, in fact, the correct procedure for completing the interactive rebase, but at any rate, I've found the following:  

While that first log message is displayed (before clicking 'close' and receiving the abort message), open the terminal. Next to your username, you should see some text to the effect that the rebase is ongoing, and you can use the two commands specified to amend the desired commits and conclude the rebase. This barely qualifies as a solution, since you might as well have just initiated the rebase from git bash at that point, but at least you will be able to apply your changes.

Hope that helps a bit.

comments: author: Tim Schroeder
body: That is currently what I am doing as well I figured that out after posting this, should have probably mentioned that. I know from watching others use this feature on Mac this is not the correct behavior, but at least it lets you use the gui to order the commits etc and do you rebase.
Windows SourceTree version showing error 'Content-Type' is an unexpected Token
Asked by abhishek_abc:

I am trying to install SourceTree windows version in my WIN 7. It was working fine suddenly now its failing to do any operation and for anything is says-

"Content-Type is an unexpected token The expected token is '"' or '"'. Line 2 , position 18"![](../../../upfiles/error_6.PNG).

Attached the screen shot


Answers:
author: Seth
body: Check to make sure you have Git installed and referenced. Tools \> Options \> Git.


author: abhishek_abc
body: attached screenshot. As soon as I click on "Clone in source Tree" , even trying to add the repository as well fails in SourceTree, always same exception it throws.


author: Seth
body: A screenshot of the error would give us a better context of when/where the error is occurring.
Setting up Sourcetree when local copies of repo exist
Asked by OC2PS:

A Sourcetree newbie needs help :-P

So, I have been using Github and have several repos on it. I plan to start creating all my new repos on Bitbucket, but plan to keep the old ones on Github, at least for a while.

Been using Github for Windows, which has a slick interface, but is very basic in terms of features. So I figured, well, maybe I'll just use SourceTree for Windows for both my Github and Bitbucket repos.

Downloaded, installed Sourcetree. Used Setup Wizard so it can log into my Github and Bitbucket repos.

The problem is I'm not sure how to tell Sourcetree that I already have local copies of the repos, and where they are located.


Answers:
author: Bal?zs Szakm?ry
body: 1. Make sure the bookmark bar is open (CTRL+B makes it appear/disappear, you can press that a couple of times to locate it. Should be on the left side, white background.)
2. In the bottom of the bookmark bar, there are a few icons. Press the leftmost one ("database" icon with a "+" on it, tooltip says Add repository).
3. In the dialog that comes up, switch to the "Add working copy" tab and locate the folder where your clone is.


author: OC2PS
body: Thanks for the detailed response. Followed your instructions and added working copy. How can I ensure that this working copy is connected to the correct Github repo?

comments: author: Bal?zs Szakm?ry
body: If it was connected before, it is still connected. (The definition of the remote(s) is a property of the clone, stored in the .git folder and does not change with the client you use.)

If you want to double-check, you can open the repository settings and see the address there. ("Settings" button on the top right; you need to open the bookmark first.)


author: OC2PS
body: Awesome! Thanks.
Sourcetree has blank windows - Not crashing
Asked by demortes:

Greetings,

I have an issue with Sourcetree which I installed on Windows 8.1. When launching it, the windows are blank. Literally nothing within the windows. I've seen that there might be an issue with Intel HD4600 drivers, but they reported running the installer from HP's website (in their case) resolved the issue and allowed them to keep their advanced graphics options. This will not apply to me, as I do not have an HP computer and will not run their software on my custom machine.

What I have done is uninstalled Sourcetree, deleted the AppData folder for Sourcetree, installed the latest drivers directly from Intel, even though I'm running an nVidia GeForce 750 TI in PCI Express. I have disabled the Intel graphics card in device manager, and this hasn't resolved the issue.

I'm at a loss as to what's next and forced to not use this software, which is the best GUI for GIT and Mercury. What can I do?

Thanks,  
Kevin 'Demortes' Dethlefs


Answers:
author: demortes
body: Running as administrator fixed this issue.
The system cannot find the path specified
Asked by Michael Curran:

I recently installed sourcetree and git. Whenever I change branches, checkout an existing branch, or push to the remote I receive the message "The system cannot find the path specified". So far the action has always completed with no issue though. I am using ssh and the remote is part of stash enterprise.

I receive the same message in SourceTree and in the shell. When I open SourceTree it queries for my ssh password and accepts it with no issue.

I am using OpenSSh if that matters

What am I missing on my setup?

Git version: 1.9.4

SourceTree version: 1.5.2.0


Answers:
author: Michael Curran
body: I found the issue, a few hooks had incorrect paths. I updated the hooks and all is working now.

Thanks for the help anyway.


author: Seth
body: Can you copy and paste a larger portion of the output of one of the commands?


Tags: bitbucket-server

git
How do I determine which versions of Git are supported by any given SourceTree version?
Asked by ryanewtaylor:

I think the title sums it up well. How do I determine which versions of Git are supported by any given SourceTree version?

I use Git + SourceTree daily. Love it! But, Git and SourceTree evolve at different rates. I would like to know when I can and when I cannot upgrade my Git client independent of SourceTree. Is there a compatibility matrix published somewhere?

Thanks,

Ryan


Answers:
author: Bal?zs Szakm?ry
body: Most of the time, there are no breaking changes from one Git version to the next, so SourceTree just keeps on working with the latest Git version available for your OS.

On the other hand, it never uses the full set of functionality of Git, so in that sense it keeps lagging quite far behind.

Point is: as far as I know, SourceTree always works with whatever Git version you have installed.


Tags: git
Can't check in files in SourceTree
Asked by Dave T:

I'm a first time user of SourceTree and am trying to check in an existing project into BitBucket. Sorry, this is probably simple but I can't figure it out. I am working from a Windows computer and have a set of source code in a directory on the computer. How do I check it in? I tried drag and drop into the bookmarks section in the left pane of the SourceTree client, but no-go.

Or if there is any documenation anywhere, can you point me to it?


Answers:
author: Seth
body: If your existing code is already a Git or Mercurial repo, you can add it to SourceTree using the "Add Working Copy" tab in the Clone/New dialog. Otherwise, add it to SourceTree in the "Create New Repository tab. You may have to commit the code to the new repo.

In Bitbucket, create a new repository. Add this new repo to your SourceTree repository as a remote. Push your branch to the Bitbucket remote.

comments: author: Dave T
body: Thanks, but can you give me more detailed instructions (or point me to some documentation -is there any)? I created the repository, and it seemed to let me add my code, but when I go to view the tree in bitbucket, there is nothing there.


author: Seth
body: Have you used Git before? Your confusion sounds like it stems from a misunderstanding of the differences between Git/Hg versus CVS/SVN.


author: Dave T
body: You're right - I've used GIT but am rusty. I am more experienced with CVS and SourceSafe. That's why I could use some doc. What I want to do must be pretty straightforward - just initialize a new repository with an existing project, but I can't get it to work!


author: Dave T
body: Sooo... a little help please?


author: Seth
body: Yeah, I thought I responded, but it disappeared.

SourceTree is not just a desktop interface for Bitbucket. According to the design of Git (and Mercurial), you are actually working with two distinct repositories. One of those repositories resides on your local machine, optionally managed by SourceTree. The other resides on Atlassian servers, managed by Bitbucket.

You can (and should) link these repositories to each other by configuring your local repository to view the Bitbucket one as a "remote".

Once Bitbucket is a remote, it is important to know the differences between your operations. Some, like "Commit" and "Checkout", usually operate only on your local repository. Others, like "Push" and "Pull", are used to syncronize the local and remote repos.

To add a remote, go to the Repository menu and choose "Repository Settings..."


author: Dave T
body: Aha! I am away from the computer so can't test this now, but I'm sure that's it. Thanks!But my other question is - is there any documentation for SourceTree?


author: Seth
body: The only official documentation I've heard of is in the Help menu on the Mac version. It will be added to Windows "soon" (according to Atlassian staff months ago).
How is the identicon used by Sourcetree generated?
Asked by chinhodado:

How is the identicon used by Sourcetree generated? What string is used as the input and what service or library do you use? I love my current identicon and I want to reuse it in other places.


Answers:
author: Seth
body: Are you referring to the avatar? I believe it is generated by [gravatar.com](http://gravatar.com) from your email address.
How to download gerrit changeset
Asked by Ilkka Hauta-aho:

Hi,

We are using Gerrit in our project for reviewing code. I (and some other developers) are using sourcetree. It works pretty well with gerrit. However there is one issue I haven't managed to resolve so far.

Is it possible to fetch gerrit patch with sourcetree?


Answers:
author: Timothy
body: I'd assume not. Unless you can script it out and run the script in SourceTree ([](http://blog.sourcetreeapp.com/2012/02/08/custom-actions-more-power-to-you/)<http://blog.sourcetreeapp.com/2012/02/08/custom-actions-more-power-to-you/>).

comments: author: Ilkka Hauta-aho
body: Thanks for the answer.

Is there any plans for adding gerrit support into sourcetree?
Pushed to wrong repo - revert a push
Asked by bristweb:

So in a recent push, we found a major booboo. Changes were pushed to the original repo AND the fork.

Thus a year's worth of commits all sent to the wrong place... all left in their original chronological order.... which isn't much help to revert.

The bitbucket dashboard shows "28 coommits pushed to xyz"... however when I click that link, it just shows /commits/all .

Is there a way to show all commits from a given push? Or a way to revert a push?


Answers:
author: Bal?zs Szakm?ry
body: It is not possible to show all commits from a given push, once the push is complete.

Reverting the push: In your local clone, reset the branch(es) to the last good state and (force) push them to the server. This will make all commits after the reset point(s) disappear from the server. If there are further commits on top of the bad ones, you will need to re-do them afterwards.

comments: author: bristweb
body: Thanks for the response Balazs

The problem is some of those commits occured prior to the previous state. So if I were to reset to the previous commit, it would still be wrong.


author: Bal?zs Szakm?ry
body: You need to reset to the last commit where everything was OK, which apparently is not the previous one. If this makes some "good" commits disappear as well, you need to redo them afterwards. (You can take a "backup" of the current state of the branch by renaming it to something else and then checking out the original one with the original name again. Afterwards, you can cherry pick from the backup branch to the one you are repairing.)
Diff with BBEDIT
Asked by Stan Gilbert:

How can I view differences (conflicts) in BBEDIT using SourceTree


Answers:
author: Stan Gilbert
body: Turns out you simply install BBEdit command line tools and then select BBEdit in the SourceTree prefs - Diff - Visual Diff Tool. Duh!


author: Seth
body: You'll have to research how to launch a BBEDIT diff from the command line. The go to Options\>Diff, and select "Custom" for the external diff and/or merge tool, and fill in the command and arguments boxes.