Code Monkey home page Code Monkey logo

git-up's Introduction

git-up(1) -- fetch and rebase all locally-tracked remote branches

Code Climate

WARNING

This project is no longer maintained, for several reasons:

  • I've stopped using the workflow that made it relevant to me.
  • Git 2.0 updated the default behaviour to remove the main problem it was solving (by changing the default behaviour of git push so it acts only on the current branch, instead of all branches).
  • As of Git 2.9, git pull --rebase --autostash does basically the same thing.

Accordingly, if you update to Git 2.9 or later, you can use this alias instead of installing git-up:

git config --global alias.up 'pull --rebase --autostash'

If you'd rather this happened on every git pull, then you can do this:

git config --global pull.rebase true
git config --global rebase.autoStash true

SYNOPSIS

git pull has two problems:

  • It merges upstream changes by default, when it's really more polite to rebase over them, unless your collaborators enjoy a commit graph that looks like bedhead.
  • It only updates the branch you're currently on, which means git push will shout at you for being behind on branches you don't particularly care about right now.

Solve them once and for all.

INSTALL

$ gem install git-up

Windows support is predictably absent. Try the Python port, which was started for that reason.

USE

$ git up

ALTHOUGH

git-up is working well for a lot of people, but a rigorous proof has yet to be formulated that it will definitely not mess with your git setup, delete data or post inane drivel to Hacker News on your behalf. Best practice is to delete your Hacker News account before installing.

DIFFICULTIES

Windows

Windows support is an ongoing pain. Have a look at this ticket if you really need it, or if you're bored.

spawn.rb:187:in `_pspawn': Invalid command name (ArgumentError)

If you're using RVM and you get this error, read this.

CONFIGURATION

git-up has a few configuration options, which use git's configuration system. Each can be set either globally or per-project. To set an option globally, append the --global flag to git config, which you can run anywhere:

git config --global git-up.bundler.check true

To set it within a project, run the command inside that project's directory and omit the --global flag:

cd myproject
git config git-up.bundler.check true

git-up.bundler.check [true|false]

Default: false. If true, git-up will check your app for any new bundled gems and suggest a bundle install if necessary.

git-up.bundler.autoinstall [true|false]

Default: false. If true, and if git-up.bundler.check is also set to true, git-up will run bundle install for you if it finds missing gems.

git-up.fetch.prune [true|false]

Default: true. Append the --prune flag when running git fetch, if your git version supports it (1.6.6 or greater), telling it to remove any remote tracking branches which no longer exist on the remote.

git-up.fetch.all [true|false]

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.

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

Default: unset. 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'

git-up's People

Contributors

aanand avatar boxofrad avatar decklin avatar elliotcm avatar felixbuenemann avatar jasoncodes avatar jkrag avatar martinvd avatar mbreit avatar nathanaelkane avatar nlutsenko avatar nschum avatar twe4ked avatar wisq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

git-up's Issues

Hooks

Lots of requested git-up features would be covered by a generic, language-agnostic hook system, e.g.

git config --global git-up.hooks.run.before "echo 'I run before git-up does anything'"
git config --global git-up.hooks.switch.after "echo 'I run after git-up has switched branches'"
git config --global git-up.hooks.rebase.after "echo 'I run after git-up has rebased a branch'"

and so on. Relevant arguments, (such as which branch was switched to, relevant commit hashes in the case of rebase etc) should be passed in as arguments (so they're available as $1, $2 etc).

This issue is a placeholder for fleshing out a spec for them, and referring people who request features.

Sadly, I don't have a lot of time to implement this, but if you agree that it'd be cool, either show your support here or take a crack yourself.

Feature request: file change summary

When doing a standard git pull you are given a summary of files changed and how much. eg:

Modules/moduleController.m                | 124 ++++++++++++++++++++++++++++++-----------------------------------

This output is very useful for knowing what project components you may need to rebuild. An config option, or perhaps even a default, to output this information on the current branch would be helpful. The usual git-up summary would still belong together and not split up by this information.

License missing from gemspec

Some companies will only use gems with a certain license.
The canonical and easy way to check is via the gemspec
via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

There is even a License Finder to help companies ensure all gems they use
meet their licensing needs. This tool depends on license information being available in the gemspec.
Including a license in your gemspec is a good practice, in any case.

How did I find you?

I'm using a script to collect stats on gems, originally looking for download data, but decided to collect licenses too,
and make issues for missing ones as a public service :)
https://gist.github.com/bf4/5952053#file-license_issue-rb-L13 So far it's going pretty well

[RFC] Reset to tracking branch

I'd love to get your input on the following problem:

I sometimes work on long-running feature branches, that I rebase onto the integration branch to keep up with the ongoing changes without cluttering my feature branch with merge nodes.

Now if I force push that branch to the remote repo, switch to a different machine and run git up, it'll try to rebase the local tracking branch of the feature branch because it has diverged.

It would be nice to at this point have git-up ask wether it should reset to the tracking branch instead of rebasing. This would save me from manually running git rebase --abort and git reset --hard origin/my-feature-branch.

What are your thoughts on such a feature?

.git of Submodule not followed

So, I have a repo with some submodules. I wanted to use git-up in one of the submodules, but rather than a .git folder, it had a .git FILE containing a relative path to the actual .git folder (like "../../.git/modules/SomeFolder/SubmoduleName"). Git itself seems to be ok with it, but git-up complains "Not a directory". Now, if I renamed the .git file and instead made a symbolic link to the relevant git folder, git-up worked fine. It SEEMS like maybe this shouldn't be too hard to fix, just to follow the link in the .git file if it isn't a directory.

git-up not working on OS X Mavericks

Using the basic instructions, it seems to install OK:

%> sudo gem install git-up
Fetching: git-up-0.5.12.gem (100%)
Successfully installed git-up-0.5.12
Parsing documentation for git-up-0.5.12
Installing ri documentation for git-up-0.5.12
Done installing documentation for git-up after 0 seconds
1 gem installed

However it is not functional:

%> git up
git: 'up' is not a git command. See 'git --help'.

Did you mean one of these?
pull
push

I'm setup with homebrew git that's found first before os x git:
%> for g in $(which -a git) ; $g --version
git version 1.9.0
git version 1.8.5.2 (Apple Git-48)

Not sure what to provide, not a ruby guy.

%> gem list

*** LOCAL GEMS ***

bigdecimal (1.2.5, 1.2.4)
colored (1.2)
diff-lcs (1.2.5)
git-up (0.5.12)
grit (2.5.0)
io-console (0.4.2)
json (1.8.1)
mime-types (2.2, 1.25.1)
minitest (5.3.1, 4.7.5)
posix-spawn (0.3.8)
psych (2.0.4, 2.0.3)
rake (10.1.1, 10.1.0)
rdoc (4.1.1, 4.1.0)
test-unit (2.5.5, 2.1.1.0)

%> gem --version
2.2.2

man page

Two new subcommands:

git up man: displays a man page
git up install-man: installs the man page somewhere

Could present a list of locations to install to, gleaned from manpath, or just offer a changeable default, i.e.

$ git up install-man
Directory to install the man page to [/usr/local/share/man]:

Support submodules

Currently when you use git up in a submodule you get the following stack trace:

/usr/lib/ruby/gems/1.8/gems/grit-2.4.1/lib/grit/git-ruby.rb:114:in `chdir': Not a directory - /some/path/to/our/submodule/.git (Errno::ENOTDIR)
    from /usr/lib/ruby/gems/1.8/gems/grit-2.4.1/lib/grit/git-ruby.rb:114:in `refs'
    from /usr/lib/ruby/gems/1.8/gems/grit-2.4.1/lib/grit/ref.rb:13:in `find_all'
    from /usr/lib/ruby/gems/1.8/gems/grit-2.4.1/lib/grit/repo.rb:212:in `branches'
    from /usr/lib/ruby/gems/1.8/gems/git-up-0.5.8/lib/git-up.rb:88:in `remote_map'
    from /usr/lib/ruby/gems/1.8/gems/git-up-0.5.8/lib/git-up.rb:84:in `remotes'
    from /usr/lib/ruby/gems/1.8/gems/git-up-0.5.8/lib/git-up.rb:8:in `run'
    from /usr/lib64/ruby/gems/1.8/gems/git-up-0.5.8/bin/git-up:5
    from /usr/bin/git-up:8:in `load'
    from /usr/bin/git-up:8

That's because it's a file with a pointer to the real directory:

gitdir: /the/real/path/to/our/submodule

I think it would be a nice feature to support.

control codes are output to non-tty's

In order for git-up to set the terminals color, special codes have to be emitted to stdout. This is fine, as long as stdout is connected to a tty.

If the command is executed from, say, sublime text, the output will be a standard pipe, and sublime will display the control characters as 'weird letters'.

error: Could not fetch origin
�[31m`git fetch` failed�[0m

A possible solution would be to check whether or not stdout is a tty.

Preserve merges when rebasing

Would be nice if git-up preserved merges when rebasing. It seems that can be done by setting a git config variable, though. The only problem left then is setting ORIG_HEAD to the correct value.

Next link bug

when their more items and you press next button to view more items the page displays "Sorry! This page is not available!"

up to date if no connection to remote is possible

When I run git-up without network connection, it says, that everything is up to date, even though the remote could not be reached.

rogue% git-up
ssh: Could not resolve hostname github.com: nodename nor servname provided, or not known
fatal: The remote end hung up unexpectedly
master up to date

Technically this isn't wrong as there is nothing new, but maybe a bit misleading. Displaying only the error message would be better IMHO.

git: 'up' is not a git command.

I moved from rvm to rbenv, and I can't seem to get git-up to work again. I always get git: 'up' is not a git command. See 'git --help'.. I'm guessing something is missing from my path, but I'm not really sure what to do. Any suggestions?

should lock git repository before and keep the lock for whole process

during git up i sometimes face 'fatal: Unable to create '/.git/index.lock': File exists.'

I understand that this is some other git process which interfere with git up.

I have Git cola (Git gui tool) and IntelliJ Idea running in the background. one of them is probably refreshing git state from time to time.

What i suggest is (if possible with git) for git up would be to acquire git repository lock before starting to updating all branches -> this would mean that either whole git up will work or it would not start if the lock was taken at the beginning. But there would be no possibility of it running and leaving working copy in unknown state in some branch or during a failed rebase...

Git submodules support

We have almost 20 git submodules in the project. I tried to run git-up for submodules via

git submodule foreach git up

but got

Entering '.modman/Aoe_AsyncCache'
/Library/Ruby/Gems/1.8/gems/git-up-0.5.8/lib/git-up.rb:69: warning: Insecure world writable dir /usr/local in PATH, mode 040777
/Library/Ruby/Gems/1.8/gems/grit-2.5.0/lib/grit/git.rb:77: warning: Insecure world writable dir /usr/local in PATH, mode 040777
/Library/Ruby/Gems/1.8/gems/grit-2.5.0/lib/grit/git-ruby.rb:116:in `chdir': Not a directory - /Users/zyava/Work/qvc/project_qvc/.modman/Aoe_AsyncCache/.git (Errno::ENOTDIR)
    from /Library/Ruby/Gems/1.8/gems/grit-2.5.0/lib/grit/git-ruby.rb:116:in `refs'
    from /Library/Ruby/Gems/1.8/gems/grit-2.5.0/lib/grit/ref.rb:13:in `find_all'
    from /Library/Ruby/Gems/1.8/gems/grit-2.5.0/lib/grit/repo.rb:213:in `branches'
    from /Library/Ruby/Gems/1.8/gems/git-up-0.5.8/lib/git-up.rb:88:in `remote_map'
    from /Library/Ruby/Gems/1.8/gems/git-up-0.5.8/lib/git-up.rb:84:in `remotes'
    from /Library/Ruby/Gems/1.8/gems/git-up-0.5.8/lib/git-up.rb:8:in `run'
    from /Library/Ruby/Gems/1.8/gems/git-up-0.5.8/bin/git-up:5
    from /usr/bin/git-up:19:in `load'
    from /usr/bin/git-up:19
Stopping at '.modman/Aoe_AsyncCache'; script returned non-zero status.

gem version incompatibility: posix-spawn-0.3.9 breaks git-up-0.5.12

posix-spawn-0.3.9 breaks git-up-0.5.12 (on Ubuntu 12.04, 32bit, with ruby 1.8.7, gem 1.8.15). Manually reverting to posix-spawn-0.3.8 solves the problem.

Here's the output under posix-spawn-0.3.9:

$ git up
/usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': /var/lib/gems/1.8/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:243: syntax error, unexpected tSYMBEG, expecting tAMPER (SyntaxError)
          ::Kernel::exec(*argv, :close_others=>false)
                                 ^
/var/lib/gems/1.8/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:274: syntax error, unexpected tIDENTIFIER, expecting tAMPER
...(*system_command_prefixes, cmd, :out => w, r => :close)
                              ^
/var/lib/gems/1.8/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:274: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.'
...command_prefixes, cmd, :out => w, r => :close)
                              ^
/var/lib/gems/1.8/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:274: syntax error, unexpected tASSOC, expecting '='
...prefixes, cmd, :out => w, r => :close)
                              ^
/var/lib/gems/1.8/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:526: syntax error, unexpected ',', expecting ']'
        [*system_command_prefixes, args[0]]
                                  ^
/var/lib/gems/1.8/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:526: syntax error, unexpected ']', expecting kEND
    from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /var/lib/gems/1.8/gems/posix-spawn-0.3.9/lib/posix-spawn.rb:1
    from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /var/lib/gems/1.8/gems/grit-2.5.0/lib/grit/git.rb:2
    from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /var/lib/gems/1.8/gems/grit-2.5.0/lib/grit.rb:34
    from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /var/lib/gems/1.8/gems/git-up-0.5.12/lib/git-up.rb:2
    from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /var/lib/gems/1.8/gems/git-up-0.5.12/bin/git-up:3
    from /usr/local/bin/git-up:19:in `load'
    from /usr/local/bin/git-up:19

bundler autoinstall fails

When I set the git-up.bundler.autoinstall config to true, the bundle install fails with the following message:

/Users/change/.rbenv/versions/1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find bundler (>= 0) amongst [..., ..., ...] (Gem::LoadError)
    from /Users/change/.rbenv/versions/1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /Users/change/.rbenv/versions/1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
    from /Users/change/.rbenv/versions/1.9.3-p0/bin/bundle:22:in `<main>'

I use rbenv and have bundler installed globally. bundler is also in the Gemfile of my project, but the version matches my globally-installed version.

It doesn't look like a problem with rbenv, since bundle resolved to the correct version, but then why is bundle not in the load path?

btw, when I run bundle install immediately after git up, everything works as expected.

EDIT: I just noticed that this only occurs in one repo and not others. Something that is special about this repo is that bundler is listed in our Gemfile, which I realize is not exactly standard. Could that be causing the issue?

Push git tags

It would be useful if the releases were tagged in git and pushed to github. I'm sure you already tagged them yourself, but forgot that git push doesn't push tags by default, right? ;)

Failure in posix-spawn

Note: if you experience this issue, or even if you don't, please add a row to this Google spreadsheet to help track this bug down.

git-up fails when I try to execute it from ruby 1.9.3-p194:

git:(master)$ git up
/Users/user/.rvm/gems/ruby-1.9.3-p194/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:187:in `_pspawn': Invalid command name (ArgumentError)
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:187:in `pspawn'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:160:in `spawn'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:307:in `popen4'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/posix-spawn-0.3.6/lib/posix/spawn/child.rb:105:in `exec!'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/posix-spawn-0.3.6/lib/posix/spawn/child.rb:80:in `initialize'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/grit-2.5.0/lib/grit/git.rb:345:in `new'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/grit-2.5.0/lib/grit/git.rb:345:in `native'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/grit-2.5.0/lib/grit/git.rb:372:in `method_missing'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/grit-2.5.0/lib/grit/config.rb:40:in `config_lines'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/grit-2.5.0/lib/grit/config.rb:32:in `load_config'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/grit-2.5.0/lib/grit/config.rb:27:in `data'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/grit-2.5.0/lib/grit/config.rb:14:in `[]'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/git-up-0.5.8/lib/git-up.rb:262:in `config'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/git-up-0.5.8/lib/git-up.rb:242:in `prune?'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/git-up-0.5.8/lib/git-up.rb:7:in `run'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/git-up-0.5.8/bin/git-up:5
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/bin/git-up:19:in `load'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/bin/git-up:19
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14

spawn Can't convert nil into String

$ git up
c:/Ruby192/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:162:in spawn': can't convert nil into String (TypeError) from c:/Ruby192/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:162:inspawn'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:307:in popen4' from c:/Ruby192/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.6/lib/posix/spawn/child.rb:105:inexec!'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.6/lib/posix/spawn/child.rb:80:in initialize' from c:/Ruby192/lib/ruby/gems/1.9.1/gems/grit-2.5.0/lib/grit/git.rb:345:innew'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/grit-2.5.0/lib/grit/git.rb:345:in native' from c:/Ruby192/lib/ruby/gems/1.9.1/gems/grit-2.5.0/lib/grit/git.rb:372:inmethod_missing'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/grit-2.5.0/lib/grit/config.rb:40:in config_lines' from c:/Ruby192/lib/ruby/gems/1.9.1/gems/grit-2.5.0/lib/grit/config.rb:32:inload_config'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/grit-2.5.0/lib/grit/config.rb:27:in data' from c:/Ruby192/lib/ruby/gems/1.9.1/gems/grit-2.5.0/lib/grit/config.rb:14:in[]'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/git-up-0.5.8/lib/git-up.rb:262:in config' from c:/Ruby192/lib/ruby/gems/1.9.1/gems/git-up-0.5.8/lib/git-up.rb:242:inprune?'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/git-up-0.5.8/lib/git-up.rb:7:in run' from c:/Ruby192/lib/ruby/gems/1.9.1/gems/git-up-0.5.8/bin/git-up:5:in<top (required)>'
from c:/Ruby192/bin/git-up:19:in load' from c:/Ruby192/bin/git-up:19:in

'

Update to ruby-mime-types breaks git-up

Arch just updated the ruby-mime-types package from 1.25 to 2.0

https://www.archlinux.org/packages/community/any/ruby-mime-types/

After upgrading, 'git up' fails with this message:

/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:into_specs': Could not find 'mime-types' (~> 1.15) - did find: mime-types-2.0
from /usr/lib/ruby/2.0.0/rubygems/specification.rb:1196:in block in activate_dependencies' from /usr/lib/ruby/2.0.0/rubygems/specification.rb:1185:ineach'
from /usr/lib/ruby/2.0.0/rubygems/specification.rb:1185:in activate_dependencies' from /usr/lib/ruby/2.0.0/rubygems/specification.rb:1167:inactivate'
from /usr/lib/ruby/2.0.0/rubygems/specification.rb:1199:in block in activate_dependencies' from /usr/lib/ruby/2.0.0/rubygems/specification.rb:1185:ineach'
from /usr/lib/ruby/2.0.0/rubygems/specification.rb:1185:in activate_dependencies' from /usr/lib/ruby/2.0.0/rubygems/specification.rb:1167:inactivate'
from /usr/lib/ruby/2.0.0/rubygems.rb:181:in rescue in try_activate' from /usr/lib/ruby/2.0.0/rubygems.rb:178:intry_activate'
from /usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:109:in rescue in require' from /usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:35:inrequire'
from ./bin/git-up:3:in <main>'

Edit: it seems this is actually a problem with grit, which is depending on ~> 1.15 instead of >= 1.15. Changing this manually in the grit gemspec fixed the problem, sorry for false issue.

Error with untracked working tree

I'm using git up on one of my project with multiple branches. Starting today I got an error whenever using git up. Here's the output of the command run in the shell on a Debian.

$ git up
Fetching origin
develop fast-forwarding...
Traceback (most recent call last):
File "/usr/local/bin/git-up", line 9, in
load_entry_point('git-up==1.1.2', 'console_scripts', 'git-up')()
File "/usr/local/bin/gitup.py", line 558, in run
gitup.run()
File "/usr/local/bin/gitup.py", line 185, in run
self.rebase_all_branches()
File "/usr/local/bin/gitup.py", line 265, in rebase_all_branches
self.git.checkout(branch.name)
File "/usr/local/lib/python2.7/dist-packages/PyGitUp/git_wrapper.py", line 156, in checkout
self.repo.branches, lambda b: b.name == branch_name
File "/usr/local/lib/python2.7/dist-packages/git/refs/head.py", line 218, in checkout
self.repo.git.checkout(self, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/git/cmd.py", line 227, in
return lambda *args, *_kwargs: self._call_process(name, _args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/git/cmd.py", line 456, in _call_process
return self.execute(call, **_kwargs)
File "/usr/local/lib/python2.7/dist-packages/git/cmd.py", line 377, in execute
raise GitCommandError(command, status, stderr_value)
git.exc.GitCommandError: 'git checkout develop' returned exit status 1: error: The following untracked working tree files would be overwritten by checkout:
text/WEB/retrieveAllFiles.sh
Please move or remove them before you can switch branches.
Aborting

Failure in submodule directory

I have a repo which contains a submodule, and there are other submodules in that one. Running git up in the top level works fine, but when I go to the next one I get:

smith@xnwzaizaqh:~/Projects/chef-repo/cookbooks:master$ git up
/Users/smith/.rvm/gems/ruby-1.9.3-p194/gems/grit-2.5.0/lib/grit/git-ruby.rb:116:in `chdir': Not a directory - /Users/smith/Projects/chef-repo/cookbooks/.git (Errno::ENOTDIR)
  from /Users/smith/.rvm/gems/ruby-1.9.3-p194/gems/grit-2.5.0/lib/grit/git-ruby.rb:116:in `refs'
  from /Users/smith/.rvm/gems/ruby-1.9.3-p194/gems/grit-2.5.0/lib/grit/ref.rb:13:in `find_all'
  from /Users/smith/.rvm/gems/ruby-1.9.3-p194/gems/grit-2.5.0/lib/grit/repo.rb:213:in `heads'
  from /Users/smith/.rvm/gems/ruby-1.9.3-p194/gems/git-up-0.5.5/lib/git-up.rb:84:in `remote_map'
  from /Users/smith/.rvm/gems/ruby-1.9.3-p194/gems/git-up-0.5.5/lib/git-up.rb:80:in `remotes'
  from /Users/smith/.rvm/gems/ruby-1.9.3-p194/gems/git-up-0.5.5/lib/git-up.rb:8:in `run'
  from /Users/smith/.rvm/gems/ruby-1.9.3-p194/gems/git-up-0.5.5/bin/git-up:5:in `<top (required)>'
  from /Users/smith/.rvm/gems/ruby-1.9.3-p194/bin/git-up:19:in `load'
  from /Users/smith/.rvm/gems/ruby-1.9.3-p194/bin/git-up:19:in `<main>'
  from /Users/smith/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
  from /Users/smith/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'

apparently because the .git here is not a directory, but a file with the contents:

gitdir: ../.git/modules/cookbooks

If possible, I would like git-up to either fetch/rebase all of the submodules recursively or work like normal when run within a submodule. The repo in question (chef-repo) is a private repo, and the one I'm trying to run git-up from is https://github.com/cramerdev/cookbooks

Thanks.

`git-up --help` Shouldn't Run An Update

I just installed git-up out of curiosity, and like any good *nix user, ran a man git-up and then git-up --help before playing with this new thang.

The former return gave me “No manual entry for git-up”.  Fine, some tools don't have man pages.

The latter ran a git-up!!  Holy what the fuck did you just do to my repo! I mean, an update should be fine given my current working dir state, but no!  Don't do stuff to my filesystem when I request a help page!  Bad!

Bad! Bad git-up!

git-up has an invalid date in the gemspec

~/projects/cramerdev/gearmanhq_web(master) $ git up
Invalid gemspec in [/Users/colin/.rvm/gems/ruby-1.9.2-p180@gearmanhq_web/specifications/git-up-0.5.1.gemspec]: invalid date format in specification: "2011-09-22 00:00:00.000000000Z"
/Users/colin/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:926:in report_activate_error': Could not find RubyGem git-up (>= 0) (Gem::LoadError) from /Users/colin/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:244:inactivate_dep'
from /Users/colin/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:236:in activate' from /Users/colin/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1307:ingem'
from /Users/colin/.rvm/gems/ruby-1.9.2-p180@gearmanhq_web/bin/git-up:18:in `

'

Installation failed with ruby 1.9.1

I am trying to install git-up on a 64-bit Ubuntu system, which reports having ruby 1.9.1 and gem version 1.8.11. I get the following error when running gem install git-up:

Building native extensions. This could take a while...
ERROR: Error installing git-up:
ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.9.1 extconf.rb

/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require': cannot load such file -- mkmf (LoadError) from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from extconf.rb:1:in `

'

does not install on OS X Mavericks

% sudo gem install git-up
Building native extensions. This could take a while...
ERROR: Error installing git-up:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb

creating Makefile

make "DESTDIR="
compiling posix-spawn.c
In file included from posix-spawn.c:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby.h:33:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/ruby.h:24:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin13/ruby/config.h:17:9: warning: '_GNU_SOURCE' macro redefined

define _GNU_SOURCE 1

    ^

posix-spawn.c:3:9: note: previous definition is here

define _GNU_SOURCE

    ^

1 warning generated.
linking shared-object posix_spawn_ext.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [posix_spawn_ext.bundle] Error 1

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/posix-spawn-0.3.8 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/posix-spawn-0.3.8/ext/gem_make.out

Requirements

I might be stupid, but would it be an idea to mention that git-up requires the Ruby development package (ruby-dev/ruby-devel)? I was pretty stumped when I was unable to install it 😅

'$ git up' fails while '$ git-up' works on ruby 2.0.0-p247

I am getting the following error when trying to run $ git up while on ruby 2.0.0-p247.

$ git up
/Users/jfox/.rvm/gems/ruby-2.0.0-p247/gems/posix-spawn-0.3.6/lib/posix_spawn_ext.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

error: git-up died of signal 6

$ git-up works.

Feature request: git-up.migrations.check/autorun

Thanks for this project, it's great.

The one thing my existing git pull replacement script does that git-up doesn't is run rake db:migrate db:test:prepare after a pull.

Our project is pretty mature so migrations are pretty rare. Unfortunately that means when someone commits one it's easy to get confused by errors and test failures until you figure out you're missing a migration.

I think if you run specs through rake it'll check for pending migrations for you maybe, but I'd rather put up with slower pulls because they try to run migrations than slows specs because I run them with rake and they take longer to start.

The way my script currently does this is to run rake db:abort_if_pending_migrations, check the return status and if necessary run rake db:migrate db:test:prepare.

That's pretty slow and maybe there's a more lightweight way of doing what db:abort_if_pending_migrations does with a direct db connection. OTOH, maybe it's as simple as listing files in db/migrate before the pull and hashing the list and then comparing with a hash of the list after the pull or even just checking the timestamp on the db/migrate directory?

Anyway, I think that'd be a really neat feature. I'm happy to have a go at coding it if someone more knowledgable can suggest the best way of doing it.

cygwin - `spawn': No such file or directory - C:\Windows\system32\cmd.exe

Does git up work under cygwin? I assumed ruby would be portable.

I just updated to cygwin latest and see this error. Had the same error with my cygwin from oct-2013 prior to update.

Fetching origin
remote: Counting objects: 11, done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 11 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (11/11), done.
From github.com:account/repo
   e1e886f..fdfb95f  master     -> origin/master
current.branchname               fast-forwarding...
/home/me-user/.gem/ruby/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:164:in `spawn': No such file or directory - C:\Windows\system32\cmd.exe (Errno::ENOENT)
        from /home/me-user/.gem/ruby/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:164:in `spawn'
        from /home/me-user/.gem/ruby/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:311:in `popen4'
        from /home/me-user/.gem/ruby/gems/posix-spawn-0.3.9/lib/posix/spawn/child.rb:141:in `exec!'
        from /home/me-user/.gem/ruby/gems/posix-spawn-0.3.9/lib/posix/spawn/child.rb:91:in `initialize'
        from /home/me-user/.gem/ruby/gems/grit-2.5.0/lib/grit/git.rb:454:in `new'
        from /home/me-user/.gem/ruby/gems/grit-2.5.0/lib/grit/git.rb:454:in `sh'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/lib/git-up.rb:225:in `rebase'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/lib/git-up.rb:130:in `block in rebase_all_branches'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/lib/git-up.rb:97:in `each'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/lib/git-up.rb:97:in `rebase_all_branches'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/lib/git-up.rb:22:in `block (3 levels) in run'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/lib/git-up.rb:199:in `returning_to_current_branch'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/lib/git-up.rb:21:in `block (2 levels) in run'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/lib/git-up.rb:183:in `with_stash'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/lib/git-up.rb:20:in `block in run'
        from /home/me-user/.gem/ruby/gems/grit-2.5.0/lib/grit/git.rb:90:in `with_timeout'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/lib/git-up.rb:19:in `run'
        from /home/me-user/.gem/ruby/gems/git-up-0.5.12/bin/git-up:5:in `<top (required)>'
        from /home/me-user/bin/git-up:23:in `load'
        from /home/me-user/bin/git-up:23:in `<main>'

Grit Times Out

On a large (365M on disk) repo, when doing git up I get:

/usr/lib/ruby/gems/1.8/gems/grit-2.3.0/lib/grit/git.rb:278:in `sh': Grit::Git::GitTimeout (Grit::Git::GitTimeout)
from /usr/lib/ruby/gems/1.8/gems/grit-2.3.0/lib/grit/git.rb:250:in `run'
from /usr/lib/ruby/gems/1.8/gems/grit-2.3.0/lib/grit/git.rb:221:in `method_missing'
from /usr/lib/ruby/gems/1.8/gems/grit-2.3.0/lib/grit/status.rb:143:in `ls_files'
from /usr/lib/ruby/gems/1.8/gems/grit-2.3.0/lib/grit/status.rb:91:in `construct_status'
from /usr/lib/ruby/gems/1.8/gems/grit-2.3.0/lib/grit/status.rb:13:in `initialize'
from /usr/lib/ruby/gems/1.8/gems/grit-2.3.0/lib/grit/repo.rb:231:in `new'
from /usr/lib/ruby/gems/1.8/gems/grit-2.3.0/lib/grit/repo.rb:231:in `status'
from /usr/lib/ruby/gems/1.8/gems/git-up-0.3.2/lib/git-up.rb:69:in `with_stash'
from /usr/lib/ruby/gems/1.8/gems/git-up-0.3.2/lib/git-up.rb:14:in `run'
from /usr/lib/ruby/gems/1.8/gems/git-up-0.3.2/bin/git-up:5
from /usr/bin/git-up:19:in `load'
from /usr/bin/git-up:19

Not sure if I can adjust Grit or git-up timeout settings.

Should return proper exit status code

Currently it always return status code 0 (success), even in case of big red error message. This makes nearly impossible to use git up in scripts:

git up && rake install

Don't apply existing stashes

When there is nothing to stash when running git up, he will apply the first available stash that already existed before the git up command.

This is (for me) unwanted behavior

"ahead of upstream" should stand out from the rest

I've just found your most excellent git-up via stackoverflow.
ran it for the first time and 2 things surprised me,
first was that I had an "ahead of upstream" branch that I should have pushed a while ago
and second that the "ahead of upstream" was not made to stand out in any way

could you please change color or make it bold or anything to make it more noticeable

thank you

Yuriy

git up *

Make a "git up *" that iterates all directories and "git up" in each that has a repo.
For that you need to change the output a bit. Remove the stashing and unstashing messages (by providing a --quiet mode or something) and forget about the "fetch" messages.
Instead of that there could be a --show-differences mode that shows unstaged files, differences in remote and local etc.

Git up not working on ruby 2.0.0-p195 on Mac

$ rvm use ruby-2.0.0-p195
$ gem install git-up
$ git up

/Users/knarf/.rvm/gems/ruby-2.0.0-p195/gems/posix-spawn-0.3.6/lib/posix_spawn_ext.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

error: git-up died of signal 6

git up not working in Ubuntu

Ran the gem install and when I run the git up command I get:

/usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in gem_original_require': /var/lib/gems/1.8/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:243: syntax error, unexpected tSYMBEG, expecting tAMPER (SyntaxError) ::Kernel::exec(*argv, :close_others=>false) ^ /var/lib/gems/1.8/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:274: syntax error, unexpected tIDENTIFIER, expecting tAMPER ...(*system_command_prefixes, cmd, :out => w, r => :close) ^ /var/lib/gems/1.8/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:274: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.' ...command_prefixes, cmd, :out => w, r => :close) ^ /var/lib/gems/1.8/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:274: syntax error, unexpected tASSOC, expecting '=' ...prefixes, cmd, :out => w, r => :close) ^ /var/lib/gems/1.8/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:526: syntax error, unexpected ',', expecting ']' [*system_command_prefixes, args[0]] ^ /var/lib/gems/1.8/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:526: syntax error, unexpected ']', expecting kEND from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:inrequire'
from /var/lib/gems/1.8/gems/posix-spawn-0.3.9/lib/posix-spawn.rb:1
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in gem_original_require' from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:inrequire'
from /var/lib/gems/1.8/gems/grit-2.5.0/lib/grit/git.rb:2
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in gem_original_require' from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:inrequire'
from /var/lib/gems/1.8/gems/grit-2.5.0/lib/grit.rb:34
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in gem_original_require' from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:inrequire'
from /var/lib/gems/1.8/gems/git-up-0.5.12/lib/git-up.rb:2
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in gem_original_require' from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:inrequire'
from /var/lib/gems/1.8/gems/git-up-0.5.12/bin/git-up:3
from /usr/local/bin/git-up:19:in `load'
from /usr/local/bin/git-up:19

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.