0

I have a remote shell that me and a few others work on. I'd like to set it up so that I can run something like gitcole ; git commit -m"example".

Where gitcole sets the relevant env variables for just that command, namely:

GIT_AUTHOR_NAME is the human-readable name in the “author” field.

GIT_AUTHOR_EMAIL is the email for the “author” field.

GIT_COMMITTER_NAME sets the human name for the “committer” field.

GIT_COMMITTER_EMAIL is the email address for the “committer” field.

I'm not very familiar with bash. How would I tackle this?

colemars
  • 979
  • 3
  • 12
  • 25
  • 1
    What have you tried so far, and what is the problem with it? What steps have you taken to become more familiar with the tool you're trying to use? – jonrsharpe Oct 30 '19 at 22:42
  • I haven't tried much because I don't want to misconfigure .bashrc on a remote machine that I don't own. – colemars Oct 30 '19 at 22:53
  • https://stackoverflow.com/a/26170085/7976758 – phd Oct 31 '19 at 10:17

1 Answers1

0

So I got this to work like so:

In my ~/.gitconfig:

[alias]
    cacm = -c user.name='colemars' -c user.email='MY_EMAIL' commit

Then you can use it like git cacm -m"commit message"

And repeat for other users.

Way simpler than I initially tried making it.

colemars
  • 979
  • 3
  • 12
  • 25