Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Convert a branch to an archived tag

I'm looking for a way to archive a (Git) branch (not export it to a file as the Repository -> Archive... command does.

I've had a brief look at custom actions, but I'm not sure how to get started. What I'd like to do:

  1. Select a branch in the BRANCHES pane
  2. Select a (custom?) action "Archive branch to tag"
  3. If the branch is fully merged:
    1. a tag is automatically created called "archive/<full-name-of-selected-branch>"
    2. the selected branch is deleted

I would also like to be able to do the reverse:

  1. Select a tag in the TAGS pane
  2. Select a (custom?) action "Restore branch from tag"
  3. If there is no branch with the same name:
    1. a branch is created, removing "archive/" from the start of the name
    2. the selected tag is deleted

Is there an existing way to do this? If not, is it possible to write a custom action to do this?

1 answer

0 votes
minnsey Atlassian Team Jan 25, 2019

Hi

I think you will struggle to do this as a simple custom action, you will essentially have to write all the logic in your external code, e.g. in a PowerShell script.

Custom actions do provide some hooks into the Sourcetree environment, i.e. $FILE, $REPO, $SHA but you will need to determine your current TAG or BRANCH information by prompting from your code as there is no mechanism with Sourcetree custom actions to prompt the user for input. 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Sourcetree

[dev team] Sourcetree for Windows 2019 Preview - Dark Theme

Hi folks, While the full post is over on our blog I'd like to share the dark theme we've got planned for 2019 here directly as well to keep the discussion going.  The ...

3,202 views 19 18
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you