nvie / git-toolbelt

A suite of useful Git commands that aid with scripting or every day command line usage
BSD 3-Clause "New" or "Revised" License
1.25k stars 111 forks source link

Support on Windows OS #29

Open magnori opened 4 years ago

magnori commented 4 years ago

Is git-toolbelt supported on Windows 10 machines?

ernstki commented 4 years ago

@magnori There could be lots of ways of answering that.

Assuming you are using Git for Windows's Bash shell, with all the default options chosen during installation then yes.

If you are using Git in PowerShell, then no. The toolbelt utilities appear to be written in Bourne shell script, and this needs a Unix shell.

If you use the Windows Subsystem for Linux, then yes. But that is Linux running inside Windows, not Windows itself.

Getting it set up with Git Bash

You wlll need to move or copy the scripts from the git-toolbelt repository to a directory in your $PATH for this to work. Here's one way that's straightforward:

# in Git Bash (included with Git for Windows)
mkdir ~/bin
cd /path/where/you/cloned/git-toolbelt
cp git* ~/bin

# test it on the 'git-toolbelt' repository
git initial-commit

Be aware of this issue, which I couldn't find a solution for, but since you probably only care about the bin directory in the Git Bash shell, I don't see this as a problem in this particular case.

~The active-branches subcommand from git-toolbelt isn't going to work for you (see #33), but the few others that I tried out worked fine.~ This has been fixed by #34.

magnori commented 4 years ago

@magnori There could be lots of ways of answering that.

Assuming you are using Git for Windows's Bash shell, with all the default options chosen during installation then yes.

If you are using Git in PowerShell, then no. The toolbelt utilities appear to be written in Bourne shell script, and this needs a Unix shell.

If you use the Windows Subsystem for Linux, then yes. But that is Linux running inside Windows, not Windows itself.

Getting it set up with Git Bash

You wlll need to move or copy the scripts from the git-toolbelt repository to a directory in your $PATH for this to work. Here's one way that's straightforward:

# in Git Bash (included with Git for Windows)
mkdir ~/bin
cd /path/where/you/cloned/git-toolbelt
cp git* ~/bin

# test it on the 'git-toolbelt' repository
git initial-commit

Be aware of this issue, which I couldn't find a solution for, but since you probably only care about the bin directory in the Git Bash shell, I don't see this as a problem in this particular case.

~The active-branches subcommand from git-toolbelt isn't going to work for you (see #33), but the few others that I tried out worked fine.~ This has been fixed by #34.

I am using Bash shell from Git for Windows, in which case it looks like the Git-toolbelt should work.

ernstki commented 4 years ago

@nvie, @magnori could one of you re-open this? There is no rev in Git Bash for Windows, which means that git-modified will not work there. See git-modified around line 124.

It's not so difficult to call tac instead (as appropriate for the platform, because macOS has no tac), and I can do a PR for that to close this issue again. Edit: tac (prints the lines of its input in reverse order) is not a substitute for rev (reverses its input character-wise, not line-wise). So this is still an open problem.

nvie commented 4 years ago

@ernstki Thanks for the offer, I would be in support of that and happy to accept that change! 🙏