happybuddha
happybuddha

Reputation: 1358

How do you know what changes are yet to be pushed?

I checked out a branch, made changes, added changes and committed. I did not push the changes.

When I do a git status it tells me

Switched to branch 'develop'
Your branch is ahead of 'origin/develop' by 2 commits.
  (use "git push" to publish your local commits)

Is there a way one can know what changes (files/code) are waiting to be pushed ?

Upvotes: 3

Views: 833

Answers (3)

Cosmin Ordean
Cosmin Ordean

Reputation: 165

You can try:

git log --name-status origin/develop..develop

Show the commits that are in the "develop" branch but not yet in the "origin/develop" branch, along with the list of paths each commit modifies.

Upvotes: 1

1615903
1615903

Reputation: 34879

git diff origin/develop will show the difference from your current branch to origin/develop.

git diff origin/develop develop will show the difference between origin/develop and develop branches when you are on any branch.

Upvotes: 3

Anton Serdyuk
Anton Serdyuk

Reputation: 1246

I personally prefer using this command to find out what's going on in my git repository:

git log --graph --all --decorate

Try it, and you will see where is your develop branch and where is origin/develop and what commits are not yet pushed to origin/develop.

Also you might find this alias helpful.

Upvotes: 1

Related Questions