Sourcetree Terminal

Today we are deprecating a Sourcetree-specific portion of the Atlassian Account sign-in API and it will be unreachable after 16 Oct 2019.

One year ago we shipped an all-new onboarding experience in 3.0 for both Mac and Windows powered by a Bitbucket login in your default browser. Prior to that, in early 2018, we tweaked the in-app registration process on Mac to use a new endpoint provided by the Atlassian Account team to achieve a more seamless experience. We are now migrating users away from this individual endpoint as it will allow their team to deliver a better Atlassian Account experience overall.

Open SourceTree and navigate to the repository you want to update the password of Run the ‘Actions Terminal’ command to jump to the location of the repo on the command line Enter ‘Git Pull’ and hit return to update the repository. Enter ls -al /.ssh to see if existing SSH keys are present: $ ls -al /.ssh # Lists the files in your.ssh directory, if they exist. Check the directory listing to see if you already have a public SSH key. By default, the filenames of the public keys are one of the following: idrsa. If the rebase process is not fully completed is can be aborted from the SourceTree terminal: git am -abort I had to perform of course additional after merge actions to align everything, but this at least helped me to get from very tough merge situation. Timlegrand Mar 29, 2016 Note that SourceTree does not start the terminal when not in a repository (e.g. Fresh install, no repo yet). To enable the terminal, either: open an existing repository.

Mitigation

  1. Download and install the latest release of Sourcetree for Mac.
  2. If you are unable to do so for any reason, download an applicable 2.x release and then perform the following steps in Terminal to setup prior to launching the app:
  • run defaults write com.TorusKnot.SourceTreeNotMAS agreedToEULA2 YES
  • then defaults write com.TorusKnot.SourceTreeNotMAS EmailHash DeprecatedEndpoint2019
  • finally defaults write com.TorusKnot.SourceTreeNotMAS completedWelcomeWizardVersion 3

Impact

There is no impact to existing installations of Sourcetree for Mac.

The following Sourcetree for Mac releases will require mitigation as noted above:

  • 2.7
  • 2.7.1
  • 2.7.2
  • 2.7.3
  • 2.7.4
  • 2.7.5
  • 2.7.6

Note: The registration and Atlassian Account portion of the Welcome Wizard will no longer complete after 16 Oct 2019.

To discuss this or any other Sourcetree topic please visit Atlassian Community.

Update 1 (no need to investigate the parents)

The use case I need this for is when a feature branch has been merged to master, and after that something arises that makes us want to remove that feature from the master branch again. In the text below I describe how to find the parents of a merge commit, but since the checked out branch always will become the parent number one when merging in another branch, the investigation of the parents isn't needed. The only command needed is therefore
git revert the_hash_of_the_commit_to_revert -m 1


Update 2 (commands for the commit message editor)

When the commit message editor opens up, just accept and exit by writing
Or, if you want to change the commit message, press i, write your message and then

Revert a 'normal' commit

Normally when you want to undo the changes of a commit that has been pushed, you can do a reverse commit inside SourceTree by doing a right click on the commit and choose 'Reverse commit...'Sourcetree like in the image below.

But if the commit you're trying to reverse is a merge commit you'll get the message:

Sourcetree Terminal Permission Denied

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=manager-st revert --no-edit 5a1f18d0d344e4ce9f23b02752cf4674c973cdf4
error: Commit 5a1f18d0d344e4ce9f23b02752cf4674c973cdf4 is a merge but no -m option was given.
fatal: revert failed

Completed with errors, see above.
Which means you've got to use the Terminal window.

Revert a merge commit

Suppose we have the state as seen in the image below. Suddenly we realize that the changes made in the demo_branch are wrong and have to be removed from the master branch.


To do this we have to issue the revert command and specify the -m option. The -m option specifies which of the parents that was the mainline that we want the resulting code to be like.

Identify the commit to revert

Sourcetree Terminal Permission Denied (publickey)

The commit we want to undo is the commit with id 0c9c102

Find the correct parent

To the right in the button bar in the top of SourceTree window there is a button for opening the Terminal window.

Click on it and you'll see the Terminal window below.
Run the command git log to list the commits. Find the commit we want to revert (when you´ve found your commit, stop the listing with ctrl-z). In the image below we see that commit 0c9c102 is a merge, having two parents with the ids 618383a (parent 1) and b8a9ad7 (parent 2).


Sourcetree Terminals

In this case we want to use the commit in the master branch as parent, the commit with id 618383a that is. That parent was listed in the log as the first parent, therefore we refer to it as parent 1.

Execute the revert command

To recap, we want to revert the commit 0c9c102 using parent 1 as the index to the -m (mainline) option. Therefore the command to write in the terminal window becomes:

Sourcetree Terminal Blocks

git revert 0c9c102 -m 1

After issuing the command an editor for editing the commit message opens up (see below). To accept the default message and exit the editor, press Esc and then ZZ.
Now a new commit has been added, which reverts the changes introduced by the merge commit.

Sourcetree Terminal Ssh Key


Done!

Sourcetree Terminal Tracking

Sources

Sourcetree Terminal Not Opening

In case you had a hard time following my explanation, maybe the answers in the sources I used can help you.