2
respostas

Alguém consegue me explicar por que não consigo enviar minhas alterações para o repositório local master?

Insira aqui a descrição dessa imagem para ajudar na acessibilidade

Gui@DESKTOP-AB65DGI MINGW64 /c/Git Alura/vinicius (titulo)
$ git add index.html

Gui@DESKTOP-AB65DGI MINGW64 /c/Git Alura/vinicius (titulo)
$ git commit -m "Correção do vini no titulo"
[titulo 75e00ce] Correção do vini no titulo
 1 file changed, 1 insertion(+), 1 deletion(-)

Gui@DESKTOP-AB65DGI MINGW64 /c/Git Alura/vinicius (titulo)
$ git checkout master
Switched to branch 'master'
Your branch is up to date with 'local/master'.

Gui@DESKTOP-AB65DGI MINGW64 /c/Git Alura/vinicius (master)
$ git rebase titulo
warning: skipped previously applied commit 841d711
hint: use --reapply-cherry-picks to include skipped commits
hint: Disable this message with "git config advice.skippedCherryPicks false"
Successfully rebased and updated refs/heads/master.


Gui@DESKTOP-AB65DGI MINGW64 /c/Git Alura/vinicius (master)
$ git push local master
To C:/Users/Gui/OneDrive/Documentos/servidor
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'C:/Users/Gui/OneDrive/Documentos/servidor'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Gui@DESKTOP-AB65DGI MINGW64 /c/Git Alura/vinicius (master)
$ git status
On branch master
Your branch and 'local/master' have diverged,
and have 3 and 1 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   index.html

no changes added to commit (use "git add" and/or "git commit -a")

Gui@DESKTOP-AB65DGI MINGW64 /c/Git Alura/vinicius (master)
$ git add index.html

Gui@DESKTOP-AB65DGI MINGW64 /c/Git Alura/vinicius (master)
$ ^C

Gui@DESKTOP-AB65DGI MINGW64 /c/Git Alura/vinicius (master)
$ git pull local master
From C:/Users/Gui/OneDrive/Documentos/servidor
 * branch            master     -> FETCH_HEAD
error: Your local changes to the following files would be overwritten by merge:
  index.html
Merge with strategy ort failed.

Gui@DESKTOP-AB65DGI MINGW64 /c/Git Alura/vinicius (master)
$ git push local master
To C:/Users/Gui/OneDrive/Documentos/servidor
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'C:/Users/Gui/OneDrive/Documentos/servidor'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
2 respostas

Existe uma versão mais recente do código no seu repositório, utilize git pull e tente novamente.

O comando git pull é responsável por atualizar seu código local.

Mas qual repositório? o master ou o título, pois o master eu já fiz git pull