Answer the question
In order to leave comments, you need to log in
How to properly push to git?
I recently started learning git and I have a few questions:
1) Let's say there are several branches: main, develop, release. I need to make a certain feature, I create a new branch, index it, make a comic. What should I do next? I have to push this branch to a remote repository and someone else is already merging my branch? Or should I merge the branch into develop and push develop?
2) If I've pushed changes to a remote repository, but I only have a typo in the commit message, can I safely change the message with
git rebase -i HEAD~n
and then run
git push --force origin branch-name
3) If I've pushed changes to a remote repository, but realize after a while that I need to revert my commit, should I use git revert? is there any other safe way?
Answer the question
In order to leave comments, you need to log in
1. If you are part of a team that works with a remote repository, then you push your branch, and then someone (for example, you) merges it. Either immediately or after PR.
If you just want to make a contribution to the github, then you fork the repository and commit changes to the original repository through PR
2. If only you work in this branch, and the rules do not prohibit this.
Otherwise, other people will have difficulties, because they have the old version of the commit.
So it's better not to.
3. As well as in p2 - if possible, you can reset it
If not - revert
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question