Skip to content
This repository has been archived by the owner on Aug 25, 2022. It is now read-only.

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita Chernyi committed Sep 26, 2017
0 parents commit d9b2b87
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# bump.sh

* Collects changes from commit summaries between branches
* Generates file `CHANGELOG` with list of all changes
* Commits that file with commit summary `Release v<NEW_VERSION>`
* Creates new tag with release version
* Pushes commit with new tag
* Opens Gitlab Merge Request (url generated from origin url) with predefined title, description and branches in browser

**PLEASE**, use http://semver.org/

## Integration with git

```bash
sudo curl -o /usr/local/bin/git-bump -s https://raw.githubusercontent.com/rakshazi/bump.sh/master/bin && sudo chmod +x /usr/local/bin/git-bump
git config --global alias.bump "git-bump"
```

## Usage

```bash
# Inside your repo
git bump <BRANCH_FROM> <BRANCH_TO>
```

`BRANCH_FROM` default: current branch

`BRANCH_TO` default: master

Just use:

```bash
git bump
```

And enjoy magic :)
17 changes: 17 additions & 0 deletions bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

BRANCH_CURRENT=$(git rev-parse --abbrev-ref HEAD)
BRANCH_1="${1:-$BRANCH_CURRENT}"
BRANCH_2="${2:-master}"
CHANGES=$(git log --oneline --no-merges --full-history $BRANCH_1...$BRANCH_2 | sed -u 's/^/\* /g')
PREVIOUS_VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))
REPO_URL=$(git remote get-url origin | sed -u 's/git@//g; s/:/\//g; s/.git//g')
printf "CHANGES:\n$CHANGES\n\n"
echo -n "Enter new version (BRANCH: $BRANCH_CURRENT | Previous version: $PREVIOUS_VERSION): "
read NEW_VERSION
echo -e "# Release v$NEW_VERSION\n\n$CHANGES\n\n$(cat CHANGELOG)" > CHANGELOG
git add CHANGELOG
git commit -m "Release v$NEW_VERSION"
git tag $NEW_VERSION
git push --follow-tags
xdg-open "$REPO_URL/merge_requests/new?utf8=✓&merge_request[source_branch]=$BRANCH_1&merge_request[target_branch]=$BRANCH_2&merge_request[title]=$NEW_VERSION&merge_request[description]=$CHANGES"

0 comments on commit d9b2b87

Please sign in to comment.