Pages

Friday, January 30, 2015

Archive git branches in "arhive/" tags

$ git branch | grep -v "master" | sed 's/^[ *]*//' | sed 's/.*/& &/' | sed 's/^/git tag archive\//' | bash

Description by segments delimited by pipe (|)


1. List all git branches


2. Exclude master


3. Trim output and remove display elements such as * next to current branch


4. Repeat branch name after a space (output on each line: branch_name branch_name)


5. Prepend each line with the git tag command


6. Execute the output with bash




commandlinefu.com


by David Winterbottom (codeinthehole.com)






from All commands http://ift.tt/165hQsb

No comments:

Post a Comment