joseluisq / gitnow

Speed up your Git workflow. :tropical_fish:
https://github.com/joseluisq/gitnow
MIT License
391 stars 25 forks source link

'pull' does not pull tags in auto mode #36

Closed lukasgierth closed 3 years ago

lukasgierth commented 3 years ago

Is there a reason why the 'pull' command does not also automatically pull the tags (in auto mode)?

I think it would make sense to always also fetch the tags when pulling in auto mode.

joseluisq commented 3 years ago

https://github.com/joseluisq/gitnow/blob/45f24583e8d375eaf84ca204ecdbcd8a0a13ce26/conf.d/gitnow.fish#L163 I think is not bad idea but do you want for example for Alt + d pull the tags all the time? Since it implies a git fetch --tags (second command) and using just pull --tags fetches remote tags refs/tags/* only.

lukasgierth commented 3 years ago

Sorry for the late answer, totally forgot this was open...

I think something like pull --tags for the automatic mode pull mode should be good enough honestly, keeps it simple. We could do the same for the automatic push mode with push --tags to trigger git push --follow-tags

joseluisq commented 3 years ago

For pull in auto mode looks fine. For example it is possible to pull commits as well as tags using the same git pull command.

~> git pull origin master --tags
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 5 (delta 2), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), 475 bytes | 67.00 KiB/s, listo.
From git.server.net:joseluisq/testing
 * branch            master     -> FETCH_HEAD
 * [new tag]         v2.0.0     -> v2.0.0
 * [new tag]         v3.0.0     -> v3.0.0
   b5e8869..b3a7a86  master     -> origin/master
Updating b5e8869..b3a7a86
Fast-forward
 example.txt  | 2 +-
 example2.txt | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
 create mode 100644 example2.txt

So we could append --tags to the $xdefaults variable in auto mode.

https://github.com/joseluisq/gitnow/blob/2d22edcd510a1f42b935190697093316c3371c47/conf.d/gitnow.fish#L142-L163

PR welcome.

joseluisq commented 3 years ago

We could do the same for the automatic push mode with push --tags to trigger git push --follow-tags

In contrast to the pull command (remote to local). For the push command I don't think will be a good idea to push all tags to a remote since for example you don't always want to push your version tags to an environment under CI/CD or another automated envs. Usually tags (for releases for example) happen on demand.

However we could tweak the push command like push --tags to support tags pushing via the git push --follow-tags under the hood but this should be triggered by the user on demand and not in auto mode.

lukasgierth commented 3 years ago

I did create a pull request for the expansion of 'pull auto mode' xdefaults.

However we could tweak the push command like push --tags to support tags pushing via the git push --follow-tags under the hood but this should be triggered by the user on demand and not in auto mode.

Yes, this seems like the most sensible solution. So a second 'semi auto mode' (not completely manual) when only '--tags' is given as an argument? I created a pull request for that. Feel free to comment/change it, that was a simple idea i implemented in five minutes.

joseluisq commented 3 years ago

Reviewed