简体   繁体   English

查找无法与另一个分支进行比较的当前分支已更改的文件

[英]Find files that have changed of current branch without being able to compare to another branch

My CI environment only has the branch being pushed. 我的CI环境只有分支被推送。 Is it possible to see all files that have changed since the creation of the branch without comparing it to another branch? 是否可以查看自创建分支以来已更改的所有文件,而无需将其与另一个分支进行比较?

I found multiple examples comparing branches, but nothing that worked when only one branch is available. 我发现有多个比较分支的示例,但是当只有一个分支可用时,没有任何效果。

I'm trying to think outside the box, like number of commits with the branch name then get that many commits from the log like such where -n would be the number of commits: 我试图在框外思考,例如具有分支名称的提交数量,然后从日志中获取大量提交,例如-n将是提交数量:

git log --name-only --pretty=format: -n 5 | sed '/^$/d' | uniq

but I cannot find a way to get the correct number of commits 但是我找不到一种方法来获取正确的提交数量

git log - include the initial commit git log-包含初始提交

/mnt/c/git/ConsoleApp1 (master)>git log --name-only --oneline --pretty=format: | sort | uniq

ConsoleApp1/Class1.cs
ConsoleApp1/ConsoleApp1.csproj
ConsoleApp1/Program.cs
ConsoleApp1.sln
.gitignore
x.txt
z.txt

git diff-tree Not including the first commit git diff-tree不包括第一次提交

  1. Find the first commit eg git rev-list or git log 查找第一个提交,例如git rev-listgit log
  2. git diff-tree git diff树

     C:\\git\\ConsoleApp1>git diff-tree --no-commit-id --name-only -r 2f6e395..HEAD ConsoleApp1/Class1.cs x.txt z.txt 

git show - including first commit git show-包括第一次提交

  1. Find the first commit eg git rev-list or git log 查找第一个提交,例如git rev-listgit log
  2. git show - please note that git show is a porcelain command and it's not meant for scripting git show 请注意,git show是一个瓷器命令,并非用于编写脚本

     C:\\git\\ConsoleApp1>git show --name-only --pretty="" -r 2f6e395..HEAD && git show --name-only --pretty="" -r 2f6e395 z.txt x.txt ConsoleApp1/Class1.cs .gitignore ConsoleApp1.sln ConsoleApp1/ConsoleApp1.csproj ConsoleApp1/Program.cs 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 查找在分支中专门更改的文件 - Find files that changed specifically in a branch 如何在不切换当前本地分支的情况下比较远程分支中同一提交中的两个文件? - How to compare two files in the same commit that is in the remote branch without switching the current local branch? 分支中的文件没有合并到分支中 - Files on branch without being merged into it 当另一个分支合并到一个分支中时,如何查找更改的文件(忽略合并分支中的更改)? - How to find the files changed in one branch when another has been merged into it (ignoring changes from the merged branch)? 如何将当前分支与 Visual Studio 2019 中的另一个分支进行比较? - How to compare the current branch with another branch in Visual Studio 2019? git - 查找已创建的分支中已更改的文件 - git - find files changed in branch, since created 将更改的文件移动到另一个分支以进行签入 - moving changed files to another branch for check-in 如何将文件从另一个分支导入到当前分支? - How to get files from another branch into my current branch? 如何从另一个分支签出文件,然后覆盖当前分支 - How to checkout files from another branch and then overwrite the current branch 在不影响当前分支的情况下从另一个分支获取更改 - Get changes from another branch without affecting current branch at all
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM