Skip to content

Commit

Permalink
Change merge-branch to merge-into-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
mhartl committed Apr 18, 2019
1 parent fff7d7e commit a3fec67
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The `git-utils` used to be pure Bash scripts, but they are now available as a Ru
* `git amend`: alias for `git commit --amend`
* `git bump`: makes a commit with the message "Bump version number"
* `git cleanup`: deletes every branch already merged into current branch (apart from `master`, `staging`, `development`, and any branches listed in `~/.git-cleanup-preserved`). Pass the `-r` option to delete remote merged branches.
* `git merge-branch [branch]`: merges current branch into given branch (defaults to `master`)
* `git merge-into-branch [branch]`: merges current branch into given branch (defaults to `master`)
* `git minor`: makes a commit with the message "Make minor changes"
* `git open`: opens the remote page for the repo (OS X & Linux)
* `git polish`: makes a commit with the message "Polish"
Expand All @@ -30,17 +30,17 @@ The `git-utils` used to be pure Bash scripts, but they are now available as a Ru

Here are some suggested aliases:

git config --global alias.mb merge-branch
git config --global alias.pr pull-request
git config --global alias.pb push-branch
git config --global alias.mib merge-into-branch
git config --global alias.pr pull-request
git config --global alias.pb push-branch

## Further details

Some of these commands deserve further explanation.

### git merge-branch
### git merge-into-branch

`git merge-branch [target]` merges the current branch into the target branch (defaults to `master`). On a branch called `add-markdown-support`, `git merge-branch` is equivalent to the following:
`git merge-into-branch [target]` merges the current branch into the target branch (defaults to `master`). On a branch called `add-markdown-support`, `git merge-into-branch` is equivalent to the following:

$ git checkout master
$ git merge --no-ff --log add-markdown-support
Expand All @@ -51,7 +51,7 @@ Note that this effectively changes the default merge behavior from fast-forward
In addition, the `--log` option puts the commit messages from the individual commits in the merge message, which is especially useful for viewing the full diff represented by the commit.

These options can be overriden (and thus restored to their defaults) by passing the options `-ff` or `--no-log`. `git merge-branch` accepts any options valid for `git merge`.
These options can be overriden (and thus restored to their defaults) by passing the options `-ff` or `--no-log`. `git merge-into-branch` accepts any options valid for `git merge`.

### git push-branch

Expand Down
6 changes: 3 additions & 3 deletions bin/git-merge-branch → bin/git-merge-into-branch
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
require 'git-utils/merge_branch'

# Merges the current branch into the given branch (defaults to master).
# E.g., 'git merge-branch foobar' merges the current branch into foobar.
# 'git merge-branch', merges the current branch into master.
# git merge-branch uses the --no-ff --log options to ensure that the
# E.g., 'git merge-into-branch foobar' merges the current branch into foobar.
# 'git merge-into-branch', merges the current branch into master.
# git merge-into-branch uses the --no-ff --log options to ensure that the
# merge creates a new commit object and that the individual commits appear
# in the log file.
exit Command.run!(MergeBranch, ARGV.dup)
4 changes: 2 additions & 2 deletions lib/git-utils/merge_branch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class MergeBranch < Command

def parser
OptionParser.new do |opts|
opts.banner = "Usage: git merge-branch [branch] [options]"
opts.banner = "Usage: git merge-into-branch [branch] [options]"
opts.on_tail("-h", "--help", "this usage guide") do
puts opts.to_s; exit 0
end
Expand Down Expand Up @@ -32,4 +32,4 @@ def cmd
def target_branch
self.known_options.first || 'master'
end
end
end
2 changes: 1 addition & 1 deletion lib/git-utils/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Git
module Utils
VERSION = "1.0.0"
VERSION = "2.0.0"
end
end
8 changes: 4 additions & 4 deletions spec/commands/merge_branch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

its(:cmd) { should match /git merge/ }

shared_examples "merge-branch with known options" do
shared_examples "merge-into-branch with known options" do
subject { command }
it "should not raise an error" do
expect { command.parse }.not_to raise_error(OptionParser::InvalidOption)
Expand All @@ -26,13 +26,13 @@

describe "with some unknown options" do
let(:command) { MergeBranch.new(['dev', '-o', '-a', '-z', '--foo']) }
it_should_behave_like "merge-branch with known options"
it_should_behave_like "merge-into-branch with known options"
its(:cmd) { should match /-a -z --foo/ }
end

describe "command-line command" do
subject { `bin/git-merge-branch --debug development` }
subject { `bin/git-merge-into-branch --debug development` }
it { should match /git checkout development/ }
it { should match /git merge --no-ff --log/ }
end
end
end

0 comments on commit a3fec67

Please sign in to comment.