0

So I'm trying to use Autohotkey to run a basic line script:

F19::
Send git checkout master; git pull; git merge nick; git push; git checkout nick; git merge master;
return

This works in any program but command prompt. I am using a mac keyboard on a windows machine, but have no issues with the F keys. I have this routed to F19. When I hit the key in git's command prompt within SmartGit, I get nothing. I've also tried rerouting the shortcut key to another bind, again with no result.

I am wondering if there is something in my command script that I am calling improperly?

Thank you in advance.

Ishio
  • 755
  • 2
  • 9
  • 29
  • Have you considered just making an [alias](http://stackoverflow.com/questions/7534184/git-alias-multiple-commands-and-parameters)? – Roman Mar 17 '15 at 13:26
  • @R0MANARMY I've looked into it, but it seems I would have to make an alias for each git. I was hoping to run a single line. It seems that SourceTree's command line works with the short key, but command prompt and SmartGit's command prompt will not. While I would like to use Source Tree, a member in my team prefers I use SmartGit to keep consistent with the team. – Ishio Mar 17 '15 at 13:53
  • I'm not sure what you mean by "each git". It should just live in your global `.gitconfig` and be available from every shell. – Roman Mar 17 '15 at 15:13
  • @R0MANARMY I mean by each git command "git checkout, git pull" etc... stringing them together in one line. – Ishio Mar 17 '15 at 15:19
  • 3
    You do realize that `;` equals the `//`in other languages, right? If so, feel free to ignore my concern. – phil294 Mar 17 '15 at 16:53
  • @Blauhirn No I did not. I am very new within PHP, and js and not familiar with anything outside CSS, HTML. – Ishio Mar 17 '15 at 19:39
  • I don't understand any of your question, but then, use `; in your send command – phil294 Mar 17 '15 at 19:40
  • As you are using SmartGit -- did you consider to define an external tool in the Preferences which invokes your commands (or a script containing your commands)? – mstrap Mar 17 '15 at 21:40
  • @mstrap No, not at all. My knowledge of SmartGit is very limited, and I received training as far as, adding a repository, initial commit, adding a remote connection to the repo, and fetching/pulling/pushing/merging. Perhaps I should look at SmartGit's wiki for additional information instead of wasting your all's time. My apologies. – Ishio Mar 18 '15 at 13:09

1 Answers1

2

I would think a bash alias would work better in this situation.

alias dostuff="git checkout master && git pull && git merge nick && git push && git checkout nick && git merge master"

EDIT:

You could also make this more flexible by letting it take parameters ie. your branch name by using a function.

dostuff() {
  git checkout master && git pull && git merge $1 && git push && git checkout $1 && git merge master
}

Calling it with dostuff nick

Elliot DeNolf
  • 2,920
  • 1
  • 15
  • 12
  • Hmmm, maybe I'm doing it wrong. I tried running the following git config --global alias.checkin "git checkout master && git pull && git merge nick && git push && git checkout nick && git merge master" in the command prompt of git – Ishio Mar 17 '15 at 19:44
  • What did it give you when you ran `git checkin`? – Elliot DeNolf Mar 18 '15 at 16:29
  • It looks like you ran your git config line above incorrectly, if you're receiving that response. – Elliot DeNolf Mar 19 '15 at 19:20