Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view the committed files you have not pushed yet?

Tags:

git

github

For example I commit some files, the next day some more files, and so on. After some days I want to view all my committed files and view their difference with the remote repo. Note that I have not pushed anything. I just want to verify that if I push some thing then it will go to the remote repo as I expect.

like image 737
Usman Ali Avatar asked Oct 19 '10 10:10

Usman Ali


People also ask

How do you see committed changes before pushing?

Solution. 2.1 git log to display all the commit_id, the first one is the last commit_id, copy it. 2.2 git show commit_id --name-only to display all the files committed in the specified commit_id. 2.3 Undo the last commit with git reset --soft HEAD~1 , move the mistakenly committed files back to the staging area.

How do I see files before a commit?

If you just want to see the diff without committing, use git diff to see unstaged changes, git diff --cached to see changes staged for commit, or git diff HEAD to see both staged and unstaged changes in your working tree. +1 Yes. git diff . htaccess does what I wanted to achieve.

How do you see all files in a commit?

To find out which files changed in a given commit, use the git log --raw command.


3 Answers

Assuming you're on local branch master, which is tracking origin/master:

git diff --stat origin/master.. 
like image 171
bstpierre Avatar answered Sep 30 '22 12:09

bstpierre


Here you'll find your answer:

Using Git how do I find changes between local and remote

For the lazy:

  1. Use "git log origin..HEAD"
  2. Use "git fetch" followed by "git log HEAD..origin". You can cherry-pick individual commits using the listed commit ids.

The above assumes, of course, that "origin" is the name of your remote tracking branch (which it is if you've used clone with default options).

like image 36
tom Avatar answered Sep 30 '22 13:09

tom


The push command has a -n/--dry-run option which will compute what needs to be pushed but not actually do it. Does that work for you?

like image 44
Noufal Ibrahim Avatar answered Sep 30 '22 12:09

Noufal Ibrahim