FredrikNoren / ungit

The easiest way to use git. On any platform. Anywhere.
MIT License
10.44k stars 637 forks source link

Optionally set an author for a commit #1146

Open Ithilias opened 5 years ago

Ithilias commented 5 years ago

It would be very nice to optionally set an author for a commit. So if several people are working with the same ungit environment, they don't have to change the global git settings.

SuddenGunter commented 5 years ago

Can't ungit use local repo user?

jung-kim commented 5 years ago

Ungit uses "nearest" config. If local config is set it will use local config. If not it will use global.

Are you asking for more specific way using ungit's config rather than git's config?

Ithilias commented 5 years ago

On command line you can set an author like this: git commit -m "foo bar" --author="Foo Bar <foo.bar@bar.foo>" I'm asking for a similar function in ungit. This might help understanding my issue: screenshot Other thought that comes to my mind is to specify several authors in the ungit config and replace the author input with a dropdown or suggest an author on input.

jung-kim commented 5 years ago

Hmm, I'm little reluctant to implement what is described as it would mean one would have to input non default email every time one commits if one wants different email per commit.

What I think it might be more tangible is an option to provide commit email in .ungitrc. Now, this implies that for the shared environments you might want to run multiple instances of ungit running but commit email is configured per ungit.

I guess I'm not yet convinced that committer email should be a config that needs to be altered adhoc

apapsch commented 5 years ago

It seems the underlying issue is whether ungit should work more like a desktop app or like a web app. Ungit is currently not used as a desktop app (i.e. electron app) but running as a web server. That's inviting to let many users use the same ungit instance. (Running several just for the author would also increase maintenance and be wasteful). IMHO there should a local user config where the last used author and/or committer is saved. If it isn't saved, it is read like you described from the config. Local Storage is a candidate for local user config.

jung-kim commented 5 years ago

hmm you are right, it is bit wasteful to have multiple process just for the sake of author.

I do agree that local storage is better and would have to implement something on the UI side to fix this.

Sogolumbo commented 4 years ago

Here's a possible workaround until a 'change user' feature or something similar is added: In my case this was very helpful (change .gitconfig file). You can specify the user based on the directory of the git project. Works well with ungit.