Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Moving untracked files #17

Closed
oschrenk opened this Issue · 6 comments

4 participants

Oliver Schrenk Ryan Tomayko Alex Morega Ben Chatelain
Oliver Schrenk

I use git sh a lot these days to save me some keystrokes.

When I want to move some untracked files though using

master!project *> mv file1 file2

I get

fatal: not under version control, source=file1, destination=file2

Is there a workaround?

Ryan Tomayko
Owner

Yeah. This is super annoying. It's because mv is using git-mv. The only way around it is to use command mv file1 file2. You may also be able to realias mv to command mv but I haven't tried.

I've considered removing the mv alias due to the confusion here.

Oliver Schrenk

Solution would be to test if file is tracked or not and act accordingly. As a workaround you can use noop

: && mv file1 file2.
Alex Morega

The following lines in my .gitshrc make mv/rm a bit more sane, without any changes to git-sh itself:

unalias mv
unalias rm
alias gmv='git mv'
alias grm='git rm'
Oliver Schrenk

Thanks for that!

Ryan Tomayko
Owner

There's a note about this in the README. Closing.

Ryan Tomayko rtomayko closed this
Ben Chatelain

I've worked up a couple bash functions for .gitshrc that will route tracked files to git mv/rm and untracked files to their bash counterparts.
https://github.com/phatblat/dotfiles/blob/master/.gitshrc#L66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.