0

I made some modifications, then run the following commands

git add .

git commit -m'my message'

after that I run git push and apparently, the push was successful.

so I run

git status

and I got the following status

On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean

so I run git push again, this time git returned the following message

Everything up-to-date

if I run git log, I get the following message(2 last commits)

commit a85e6bd90d07d50d66d1b8d057e90df06067be10 (HEAD -> master, upstream/master)
Author: myname <myemail@gmail.com>
Date:   Sat Aug 15 11:10:09 2020 -0300
    glossary file

commit 87e0fcbf40f4faccba41375f30dde2aadc4336b6 (origin/master)
Author: myname  <myname@gmail.com>
Date:   Fri Dec 27 16:40:22 2019 -0200

Added Maintenance Work Request and Non Maintenance Work Request entities.

why there seems to be a commit in my local repo that is not in remote repo even after push to remote was successful?

mike
  • 1,233
  • 1
  • 15
  • 36
Vitor Mira
  • 93
  • 10
  • Your repository will contain *every* commit. So will the other repository. The `git push` command sends commits to them if they don't have them, and you do, and you want to send them (which is what you did). The `git fetch` command gets any commits *they* have that *you* don't. So—skipping over a LOT of details that matter—after doing both of these operations, both repositories will usually contain all the same commits. If only one repository has any *new* commits, you only need one operation to synchronize. – torek Aug 15 '20 at 15:43
  • 1
    In your particular case, though, it looks as though you have *two* other Git repositories that you need to exchange with. One is probably called `origin` (though you wrote `origem` here), and the other is apparently called `upstream`. So you'd need to use`git push` and/or `git fetch` with *both* `origin` *and* `upstream` to synchronize all three. – torek Aug 15 '20 at 15:45
  • What's really throwing me off is `origem` instead of `origin`. There's also a mention of the remote `upstream` in your output. To which remote did you push? How are the remotes related? – knittl Aug 15 '20 at 19:44
  • The problem is merely that you have two remotes. You push to one but you are then still not in sync with the other. – matt Aug 16 '20 at 12:19
  • Also this phrase is meaningless: “why there seems to be still a commit remaining in my local repo” All the commits always remain in your local repo. That’s what git is. – matt Aug 16 '20 at 12:26
  • Do not put the answer into the question. – matt Aug 27 '20 at 12:47

2 Answers2

0

use

git push -u origin yourlocalbranchname
hedy
  • 1,160
  • 5
  • 23
Sonali Das
  • 943
  • 1
  • 7
  • 24
0

That repo was migrated from bitbucket into github. It seems that there was some confusion in the configuration of url of remote branch or/and the association between local and remote branch. So I unset the configured urls and also the associations and set the url and associations based on the instructions in the following answer https://stackoverflow.com/a/625460/8765728

After the modifications, this is the output of command

git config -l

Vitor Mira
  • 93
  • 10