E
E
Elena2020-07-25 14:17:07
git
Elena, 2020-07-25 14:17:07

When should I push git push --tags?

People, something is completely confused, I don’t understand when to start git push --tags.
Is this correct for me?:

git add .
# добавили файлы к коммиту

git commit -m "first commit"
# коммитим

git tag -a v0.0.1 -m "my first version"
# прописали версию

Then it turns out you need to push the tag, but when to do this, right?
git push --tags
# загрузили версии в гит
git remote add origin https://github.com/.git
git push -u origin master

Or after git push -u origin master?

Issue resolved!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Belyaev, 2020-07-25
@Elena0394

git push will simply pour all local commits into the latest remote branch without parameters, if git knows which last one, of course,
git push with the -u flag allows you to specify which remote repository (in the question, this is origin) and which branch in it (in in the question, this is master) upload commits
git remote manages remote repositories
, in particular, git remote add adds a new one under the specified name (in the question, this is origin) and located under the specified url (in the question, this is https://github.com/.git )
git push - -tags uploads only tags to the last remote branch, without commits,
but a tag is just a symbolic link to a specific commit and there is no point in it without the commit itself
so git push --tags must come after git push

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question