9

Is there some shortcut for filepath, because it's very annoying write full path again and again?

Some kind regular expression or something else.

I know, I can use "Tab" key, but...

UPDATE:

Windows and default sh.exe from Git

ANSWER:

Git extensions from holygeek are what I looking for, but his version is working only on *NIX like systems or cygwin with newer version of Bash.

That is reason, why I created little fix for msysgit => here

Community
  • 1
  • 1
MicTech
  • 42,457
  • 14
  • 62
  • 79
  • What platform/OS are you running in? What's your terminal? – slebetman Aug 12 '10 at 07:09
  • 1
    If you have to use the full path, and it can't be shortened, and you can't just run the commands from a subdir (see Benjol's answer), then you could set a shell variable(s) to abbreviate the path(s) that are annoying to type. – bstpierre Aug 12 '10 at 12:32
  • @bstpierre, that's true. I read the question as wanting a general solution, if it's just a couple of specific paths, but it could be taken both ways. – Benjol Aug 13 '10 at 05:11

3 Answers3

8

in the git-bash, try

declare -x YOURVARIABLENAMEHERE=C:/.../.../
cd $YOURVARIABLENAMEHERE

takes me right to the specified directory.

mnodeland
  • 121
  • 1
  • 4
  • This works great, but how do you ensure that characters in quotation marks remain? i.e. `declare -x www="/c/Program Files (x86)/Ampps/www"` I would have to do `cd "$www"` in order to change to that directory everytime – inkovic Jun 06 '15 at 05:23
4

I wrote a tool that allow me to use numbers when dealing with files in git (git-number).

I've been using it on linux (a couple of shell script and a perl script).

If you're feeling adventurous try to make it work on windows.

It's been a big productivity boost for me as I don't rely on tab completion nor do I need to write the long file or directory names anymore when manipulating files in git.

git-number: https://github.com/holygeek/git-number

holygeek
  • 15,653
  • 1
  • 40
  • 50
  • Excellent, I was ready to write such an extension myself if I couldn't find an existing one. Thanks for releasing this! – David B. Nov 30 '11 at 21:05
1

I understand what you're asking, but I'm not sure what kind of solution you're thinking of. If your filepath is potentially 'shortenable', why don't you change the names of the folders directly?

I'm no expert, but I suspect that for command-line usage, you won't find much better than what you've already got.

Using a GUI with a folder browser might be what you want? (for windows, for linux)

(If you're doing a lot of operations on multiple files in the same subfolder, you could navigate to that folder and run your commands from there - though you might want to check if the specific git commands you're using can handle that)

EDIT If there are just one or a couple of folders than you always need to refer to, you could set up a shell variable as bstpierre suggests in his comment on your question.

Community
  • 1
  • 1
Benjol
  • 63,995
  • 54
  • 186
  • 268
  • I know about subfolders, but that is annoying same as write full path, especially if I want use diff command from shell. – MicTech Aug 12 '10 at 14:37
  • @MicTech: No, it's not - you only have to `cd` once, then you can run commands with shortened paths to your heart's content. – Cascabel Aug 13 '10 at 18:12