Occasionally when you are working on a remote server, development environment or stage, it is not uncommon to make changes and need to run a commit or stash command with your author name.

However, these environments are not always configured, or, as a good practice, should not have a single author configured in Git globally, or sometimes you are in an environment of another configured author.

To identify yourself in the desired action, without having to change the global GIT configuration, you can pass the author and email to that specific command in the execution line.

For example, imagine that you have taken a test on a file in the stage environment, found that code change solves a problem, and will now make the correct flow, changing in a Dev environment, reminiscent of review and approval, for later implementation in the due environments.

However, you should not leave the direct change on the server, and must reverse the state of the code using the stash command. To identify in this single command, use the -c followed by the desired configuration:

git -c "user.name=Ademir Mazer Junior" -c "[email protected]" stash

Therefore, when using parameter -c and the name and email settings, for this specific command the information will be identified with this configuration without changing the global.

It can also be used with other Git commands.

See also how temporarily store in cache the user and password credentials for access to a repository: Temporary cache of GIT credentials – username and password

If you need a rapid and general view of GIT, which is a software versioning tool, read the introductory article of Git.