Push only some commits

Is there a way to push only some of your commits using SourceTree?


Thanks

2 answers

1 accepted

This widget could not be displayed.

You can use Custom actions, on my Mac I've done:

  1. Preferences custom actions => Add
    Menu Caption: Push to master till this commit
    Script to run: git-push-till-commit
    Parameters: $SHA
  2. In a directory, which will be searched by PATH I've created a shell script "git-push-till-commit"
    vi git-push-till-commit

    #!/bin/bash
    SHA_COMMIT_HASH=$1
    echo "Calling git push origin $SHA_COMMIT_HASH:master"
    git push origin $SHA_COMMIT_HASH:master

    chmod a+x git-push-till-commit

  3. Now if I wish to push some subset of commits, I select the last one => Right mouse click => Custom actions => Push to master till this commit
This widget could not be displayed.

Hi Gabriel,

We support this functionality in Mercurial (just right click on a log row and hit 'Push'). This will just pre-fill the revision field in the push sheet, so you can do this manually from the push sheet, too. We don't currently support this in Git despite it being technically possible using the syntax

git push <remote> <commit SHA>:<remote_branch>

You can file feature requests at jira.atlassian.com if you'd like to see this in SourceTree.

Cheers

Thank you, Kieran. I have submitted two feature requests:

Just remember it pushes all commits 'up to' the commit you specify. Thanks for the feature requests!

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

140 views 16 7
Join discussion

Atlassian User Groups

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!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you