Skip to content

Commit

Permalink
Merge remote-tracking branch 'nschum/rebasearguments'
Browse files Browse the repository at this point in the history
Conflicts:
	README.md
  • Loading branch information
aanand committed Sep 17, 2012
2 parents edaf341 + ba27957 commit 0d2b927
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -42,6 +42,10 @@ By default, `git-up` will append the `--prune` flag to the `git fetch` command i

Normally, `git-up` will only fetch remotes for which there is at least one local tracking branch. Setting this option will it `git-up` always fetch from all remotes, which is useful if e.g. you use a remote to push to your CI system but never check those branches out.

### `git-up.rebase.arguments [string]`

If this option is set, its contents will be used by `git-up` as additional arguments when it calls `git rebase`. For example, setting this to `--preserve-merges` will recreate your merge commits in the rebased branch.

### `git-up.rebase.log-hook "COMMAND"`

Runs COMMAND every time a branch is rebased or fast-forwarded, with the old head as $1 and the new head as $2. This can be used to view logs or diffs of incoming changes. For example: `'echo "changes on $1:"; git log --oneline --decorate $1..$2'`
3 changes: 2 additions & 1 deletion lib/git-up.rb
Expand Up @@ -152,8 +152,9 @@ def log(branch, remote)

def rebase(target_branch)
current_branch = repo.head
arguments = config("rebase.arguments")

output, err = repo.git.sh("#{Grit::Git.git_binary} rebase #{target_branch.name}")
output, err = repo.git.sh("#{Grit::Git.git_binary} rebase #{arguments} #{target_branch.name}")

unless on_branch?(current_branch.name) and is_fast_forward?(current_branch, target_branch)
raise GitError.new("Failed to rebase #{current_branch.name} onto #{target_branch.name}", output+err)
Expand Down

0 comments on commit 0d2b927

Please sign in to comment.