From 019f78e286db45c5c09a346b3e3d8b63e6199816 Mon Sep 17 00:00:00 2001 From: Milos Mladenovic Date: Fri, 9 Jan 2015 10:40:08 +0100 Subject: [PATCH 1/2] updated rebase to use pull --rebase --- README.md | 11 ++++++----- lib/git-up.rb | 12 ++++++------ lib/git-up/version.rb | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index c5ef70c..16e2671 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,12 @@ Solve them once and for all. INSTALL ------- - $ gem install git-up + $ ~~gem install git-up~~ + + $ git clone git@github.com:milosm/git-up.git + $ cd git-up && gem build git-up.gemspec + $ sudo gem install git-up-0.5.12.1.gem + (Version may vary) Windows support is predictably absent. Try the [Python port](https://github.com/msiemens/PyGitUp), which was started for that reason. @@ -68,10 +73,6 @@ Default: **true**. Append the `--prune` flag when running `git fetch`, if your g Default: **false**. Normally, git-up will only fetch remotes for which there is at least one local tracking branch. Setting this option to **true** will make 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] - -Default: **unset**. Additional arguments to pass to `git rebase`. For example, setting this to `--preserve-merges` will recreate your merge commits in the rebased branch. - ### git-up.rebase.auto [true|false] Default: **true**. If this option is set to **false**, git-up will not rebase branches for you. Instead, it will print a message saying they are diverged and let you handle rebasing them later. This can be useful if you have a lot of in-progress work that you don't want to deal with at once, but still want to update other branches. diff --git a/lib/git-up.rb b/lib/git-up.rb index 8e13916..b238a45 100644 --- a/lib/git-up.rb +++ b/lib/git-up.rb @@ -95,9 +95,10 @@ def rebase_all_branches col_width = branches.map { |b| b.name.length }.max + 1 branches.each do |branch| - remote = remote_map[branch.name] + remote = remote_map[branch.name] + curbranch = branch.name.ljust(col_width) + remote_name = repo.config["branch.#{curbranch}.remote"] || "origin" - curbranch = branch.name.ljust(col_width) if branch.name == repo.head.name print curbranch.bold else @@ -127,7 +128,7 @@ def rebase_all_branches log(branch, remote) checkout(branch.name) - rebase(remote) + rebase(remote, remote_name, curbranch) end end @@ -218,11 +219,10 @@ def log(branch, remote) end end - def rebase(target_branch) + def rebase(target_branch, remote_name, branch_name) current_branch = repo.head - arguments = config("rebase.arguments") - output, err = repo.git.sh("#{Grit::Git.git_binary} rebase #{arguments} #{target_branch.name}") + output, err = repo.git.sh("#{Grit::Git.git_binary} pull --rebase #{remote_name} #{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) diff --git a/lib/git-up/version.rb b/lib/git-up/version.rb index 6248384..962b27d 100644 --- a/lib/git-up/version.rb +++ b/lib/git-up/version.rb @@ -1,3 +1,3 @@ class GitUp - VERSION = "0.5.12" + VERSION = "0.5.12.1" end From e79f2c535fe6a4f2c69c785e41d72ee33962f809 Mon Sep 17 00:00:00 2001 From: Milos Mladenovic Date: Fri, 28 Aug 2015 08:14:20 +0200 Subject: [PATCH 2/2] updated README file to the default version --- README.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/README.md b/README.md index 16e2671..a16a078 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,7 @@ Solve them once and for all. INSTALL ------- - $ ~~gem install git-up~~ - - $ git clone git@github.com:milosm/git-up.git - $ cd git-up && gem build git-up.gemspec - $ sudo gem install git-up-0.5.12.1.gem - (Version may vary) + $ gem install git-up Windows support is predictably absent. Try the [Python port](https://github.com/msiemens/PyGitUp), which was started for that reason.