git-ghost icon indicating copy to clipboard operation
git-ghost copied to clipboard

Should default value of 'from-hash' in 'git ghost push' be auto resolved value??

Open everpeace opened this issue 6 years ago • 3 comments

currently 'from-hash''s defualt value is HEAD.

$ git ghost push --help
...
Usage:
  git-ghost push [from-hash(default=HEAD)] [flags]

However, if user's working repo is like

* Unsataged changes
* commtA [HEAD]
* commitB [origin/master]
I initial

git ghost push outputs commitA __diff_hash__. but below will fail

git clone
git checkout commitA
git ghost pull commitA __diff_hash__ # failed!!!

So, from-hash's default value should be auto resolved to commitA ??

everpeace avatar Apr 11 '19 09:04 everpeace

I first thought we can use a flag which takes remote branch like origin/master, but it looks the same as we directly set it as a from hash like git ghost push origin/master as it resolves origin/master internally. Then, changing the default value from HEAD to origin/master was considered as a solution, but there're many cases in which origin/master is not the "best" commit to check a merge base. We can actually provide an option to set the default value by environment variable like GIT_GHOST_DEFAULT_FROM_HASH, but specifying origin/master in a command line is more intuitive. @everpeace What do you think?

dtaniwaki avatar Apr 11 '19 10:04 dtaniwaki

introducing GIT_GHOST_DEFAULT_FROM_HASH sounds nice to me 👍

everpeace avatar Apr 12 '19 08:04 everpeace

How about resolving the commit by running git branch --remotes --contains <hash> for each commit, tracking back from HEAD?

niboshi avatar Dec 08 '20 11:12 niboshi