Alternatively, you can start a repository or repository locally with git init
.
After doing this, I recommend that you do the commits locally, even to avoid losing work case give some problem or you unintentionally execute some command with occasional side effect on the data.
Okay, after you commit, we’ll add the remote Github repository. You can follow the own tutorial from Github, or memorize some commands (explanation below command:
git remote add origin [email protected]:user/projeto-muito-legal-show.git
# \___/ \____________________________________________/
# | endereço remoto do projeto no github
# apelido do repositório remoto
git fetch origin
Ready, now you have a properly configured remote. After that, we can mix your branch place with the branch remote (if something has already been created). Or if the repository is still empty, just push.
To mix, it is usually used git merge origin/master
(documentation) to mix with the branch master
from the Github repository. But you can also try rewriting the history by all commits that you made as being children’s commits from the tip of branch remote, using the rebase
(documentation).
git merge origin/master # para fazer o merge
git rebase origin/master # para fazer o rebase
In the third case, you still have nothing on the remote. So you just need to give a git push -u origin master
(see more in this question, see the documentation).
Why not add the remote and merge?
– Jefferson Quesado
Maybe so, but I don’t think there’s a local repository
– egomesbrandao
I find it less traumatic to start the repository in the current directory, then there would be a location
– Jefferson Quesado