I am working on a local branch (let us call it bugFix123
), I normally use the following command sequences to push changes,
1. git add to add files
2. git commit -m 'description' (there could be multiple sequence of 1 and 2, suppose I have multiple commits for multiple changes, and using one single push in the final)
3. git push origin bugFix123
here is a new question, suppose I commit
multiple times for multiple local changes, before I execute command git push origin bugFix123
, how to see what are the final files to push? I tried to use command git commit
, it seems git commit
does not display the right file list to push (if there are multiple commits, before push). The purposeI want to see the final file list to push in multiple commit scenario is because I do not want to push unnecessary files and further fix them (it will send incorrect push list file notifications to others).
Edit 1,
I find git push -n
not always work,
git push -n
To [email protected]:foo/goo.git
! [rejected] master -> master (non-fast-forward)
! [rejected] update12_1 -> update12_1 (fetch first)
error: failed to push some refs to '[email protected]:foo/goo.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
regards, Lin
You can use below command to list names of all changes made since last push, however it doesn't show non commit changes
git diff --name-only origin/master..HEAD
--list all commits since last push
git log origin/master..HEAD
If you've already pushed something to bugFix123
and you want to compare your local branch bugFix123
with its remote version (for instance, origin
) you can do the following:
git diff --numstat origin/bugFix123 bugFix123
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