How can I shorten the command for making a Git commit with author specified, without setting global configuration? -
i working on scripts on shared server, , need commit progress git repository periodically. since server , user logged in both shared, don't want set global user names , e-mails, common solution not entering commit author every time. if don't specify author, git assume name name based on shared system's user , host names, commits won't associated me. have been making commits following command address this:
git commit -m "commit message" --author="firstname lastname "
how can shorten command don't have type out author every time, without setting global configuration options?
here @ least 2 options address this:
set repository-specific options
have each user uses machine make own clone of repository. then, each user can set local user name , e-mail configuration option in copy of repository:
git config user.name "firstname lastname"
git config user.email "email@domain.com"
simply leaving off --global
option create [user] section in repository's .git/config file, when user makes commit in repository, user name , e-mail attached commit.
create alias command
you can set alias committing includes author:
git config --global alias.commitauthorname 'commit --author="firstname lastname " -m'
then commit using command:
git commitauthorname "commit message"
you can leave -m
out of alias if don't want use option every time.
note: approach cause git generate following message each commit used with:
your name , email address configured automatically based on username , hostname. please check accurate.
also, each commit made alias have author set accurately, committer metadata attached commit still based on username , hostname git found.
Comments
Post a Comment