I have merged a branch in to master and now I can see that in my git log
Some time has passed and now I want to know whether I previously also pushed master (with that commit) to the remote. How can I tell if it has been pushed?
I can think of a few workaround such as recloning the repository elsewhere, or resetting and checking and then re-merging but I feel that there's probably a somewhat simpler answer.
fyi this is different from How can I know in git if a branch has been already merged into master? as I know it has been merged, just don't know about the remote push.
Viewing a list of the latest commits. If you want to see what's happened recently in your project, you can use git log . This command will output a list of the latest commits in chronological order, with the latest commit first.
Now, just typing git push on the master branch will automatically push to origin/master .
To confirm, you can run git branch . The branch that you are on will be the one with a * next to it. Git checkout might fail with an error message, e.g. if it would overwrite modified files. Git branch should show you the current branch and git log master allows you to view commit logs without changing the branch.
Do
> git status
If the output is
# On branch master nothing to commit, working directory clean
Then you have pushed the current commit.
If the output instead begins with
# On branch master # Your branch is ahead of 'origin/master' by 1 commit. # (use "git push" to publish your local commits)
Then you have a local commit that has not yet been pushed. You see this because the remote branch, origin/master
, points to the commit that was last pushed to origin. However, your branch is ahead of 'origin/master'
, meaning that you have a local commit that has been created after the last pushed commit.
If the commit you are interested in is not the latest, then you can do
> git log --decorate --oneline
to find out if the commit in question is before or after the commit pointed to by origin/master
.
If the commit is after (higher up in the log than) origin/master
, then it has not been pushed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With