检查详细文件列表以推送到git

Lin*_* Ma 4 git

我正在本地分支上工作(让我们称之为bugFix123),我通常使用以下命令序列来推送更改,

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
Run Code Online (Sandbox Code Playgroud)

这是一个新问题,假设我commit多次进行多个本地更改,在执行 command 之前git push origin bugFix123,如何查看最终要推送的文件是什么?我尝试使用 command git commit,似乎git commit没有显示要推送的正确文件列表(如果有多个提交,则在推送之前)。我想看到在多次提交场景中推送的最终文件列表是因为我不想推送不必要的文件并进一步修复它们(它会向其他人发送不正确的推送列表文件通知)。

编辑 1 ,

我发现git push -n并不总是工作,

git push -n
To git@github.com:foo/goo.git
 ! [rejected]        master -> master (non-fast-forward)
 ! [rejected]        update12_1 -> update12_1 (fetch first)
error: failed to push some refs to 'git@github.com: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.
Run Code Online (Sandbox Code Playgroud)

问候,林

abh*_*006 5

您可以使用以下命令列出自上次推送以来所做的所有更改的名称,但它不会显示非提交更改

git diff --name-only origin/master..HEAD

--list all commits since last push
git log origin/master..HEAD
Run Code Online (Sandbox Code Playgroud)