Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Commit differences between local and remote

Tags:

git

How can I ask what commits are different between my current local branch and the remote repository that I push to?

Not exactly a git diff origin/master master -- I don't want to see code differences. Just a list of changes like git log.

I want to quickly see how long it's been since I pushed and how out of sync I am.

like image 396
ack Avatar asked Aug 14 '11 16:08

ack


People also ask

How can I tell the difference between local and remote?

You can git branch -a to list all branches (local and remote) and then choose the branch name from the list (just remove remotes/ from the remote branch name. Example: git diff main origin/main (where "main" is the local main branch and "origin/main" is a remote, namely the origin and main branch.)

Does git commit affect remote?

No, unless you explicitly push your changes to the remote branch, your changes will only be in your local repository.

How do you find the difference between two commits?

To see the changes between two commits, you can use git diff ID1.. ID2 , where ID1 and ID2 identify the two commits you're interested in, and the connector .. is a pair of dots. For example, git diff abc123.. def456 shows the differences between the commits abc123 and def456 , while git diff HEAD~1..


1 Answers

Git can not send this information remotely.

You would have to do a Git fetch (fetching the changes, without altering your working copy). You will then have a branch called "origin/master" which will enable you to use git log master..origin/master to get the variance between the two.

git fetch git log master..origin/master 
like image 85
Silfverstrom Avatar answered Sep 29 '22 19:09

Silfverstrom