Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Notifications
Mark all as read
Q&A

Get unique list of all files in a git repository, which I modified

+5
−1

I would like to get a list of all the files in a git repository which I modified.

Take for example the repository https://github.com/josephwright/beamer . I tried the command

git whatchanged --author=samcarter --no-commit-id --name-only

but the resulting list does have tons of duplicate entries.

CHANGELOG.md
base/beamerbaseframe.sty
CHANGELOG.md
CHANGELOG.md
base/beamer.cls
doc/beamerug-frames.tex
CHANGELOG.md
base/themes/outer/beamerouterthemedefault.sty
doc/beamerug-overlays.tex
doc/beamerug-overlays.tex
CHANGELOG.md
base/beamerbaseframe.sty
doc/beamerug-frames.tex
CHANGELOG.md
base/themes/outer/beamerouterthemesidebar.sty
doc/beamerug-frames.tex
CHANGELOG.md
base/beamerbaseframesize.sty
base/themes/outer/beamerouterthemedefault.sty
.gitignore
base/beamerbaseboxes.sty
CHANGELOG.md
base/beamerbaseboxes.sty
CHANGELOG.md
base/beamerbaseboxes.sty
base/beamerbaseboxes.sty
CHANGELOG.md
CHANGELOG.md
base/themes/outer/beamerouterthemedefault.sty
doc/beamerug-frames.tex
doc/beamerug-nonpresentation.tex
doc/beameruserguide.tex
CHANGELOG.md
base/themes/inner/beamerinnerthemedefault.sty
CHANGELOG.md
base/beamer.cls
base/beamerbaseframecomponents.sty
doc/beamerug-localstructure.tex
doc/beamerug-notes.tex
CHANGELOG.md
base/beamerbaseboxes.sty
CHANGELOG.md
base/beamerbasefont.sty
CHANGELOG.md
base/beamerbaseframecomponents.sty
CHANGELOG.md
base/beamer.cls
base/beamerbasenotes.sty
doc/beamerug-notes.tex
CHANGELOG.md
base/themes/outer/beamerouterthemesmoothtree.sty
CHANGELOG.md
base/themes/outer/beamerouterthemesmoothbars.sty
CHANGELOG.md
base/themes/outer/beamerouterthemesmoothbars.sty
CHANGELOG.md
base/themes/outer/beamerouterthemesmoothbars.sty
doc/beamerug-animations.tex
doc/beamerug-color.tex
doc/beamerug-compatibility.tex
doc/beamerug-elements.tex
doc/beamerug-emulation.tex
doc/beamerug-fonts.tex
doc/beamerug-frames.tex
doc/beamerug-globalstructure.tex
doc/beamerug-graphics.tex
doc/beamerug-guidelines.tex
doc/beamerug-installation.tex
doc/beamerug-interaction.tex
doc/beamerug-introduction.tex
doc/beamerug-license.tex
doc/beamerug-localstructure.tex
doc/beamerug-macros.tex
doc/beamerug-nonpresentation.tex
doc/beamerug-notes.tex
doc/beamerug-overlays.tex
doc/beamerug-solutions.tex
doc/beamerug-themes.tex
doc/beamerug-transparencies.tex
doc/beamerug-tricks.tex
doc/beamerug-tutorial.tex
doc/beamerug-twoscreens.tex
doc/beamerug-workflow.tex
doc/beamerug-fonts.tex
CHANGELOG.md
base/beamerbasecompatibility.sty
base/beamerbasecompatibility.sty
CHANGELOG.md
CHANGELOG.md
base/beamerbaseauxtemplates.sty
doc/beamerug-notes.tex
CHANGELOG.md
base/beamerbasecompatibility.sty
doc/beamerug-compatibility.tex
CHANGELOG.md
base/beamerbaseauxtemplates.sty
doc/beamerug-frames.tex
doc/beamerug-animations.tex
doc/beamerug-globalstructure.tex
doc/beamerug-installation.tex
doc/beamerug-interaction.tex
doc/beamerug-introduction.tex
doc/beamerug-nonpresentation.tex
doc/beamerug-notes.tex
doc/beamerug-workflow.tex
doc/beameruserguide.tex
doc/emulation-examples/beamerexample-foils.tex
doc/emulation-examples/beamerexample-prosper.tex
CHANGELOG.md
CHANGELOG.md
base/beamerbaseboxes.sty
doc/beamerug-frames.tex
doc/beamerug-elements.tex
CHANGELOG.md
base/themes/outer/beamerouterthemeinfolines.sty
base/beamerbaseauxtemplates.sty
doc/beamerug-installation.tex
doc/beamerug-solutions.tex
doc/beamerug-tutorial.tex
doc/beamerug-workflow.tex
doc/beameruserguide.tex
doc/beamerug-localstructure.tex
CHANGELOG.md
base/beamer.cls
base/beamerbaseauxtemplates.sty
base/beamerbasetoc.sty
doc/beamerug-globalstructure.tex
CHANGELOG.md
base/beamerbaseauxtemplates.sty
base/beamer.cls
CHANGELOG.md
base/beamerbasemodes.sty
base/beamerbasesection.sty
build.lua
AUTHORS.md
CHANGELOG.md
base/beamerbaseboxes.sty
CHANGELOG.md
CHANGELOG.md
CHANGELOG.md
base/beamerbaseboxes.sty
base/beamerbaseboxes.sty
base/beamerbaselocalstructure.sty
base/themes/outer/beamerouterthemesidebar.sty
CHANGELOG.md
base/beamerbaseboxes.sty
base/beamerbaseboxes.sty
base/beamerbaseboxes.sty
base/beamerbaseboxes.sty
base/themes/outer/beamerouterthemeshadow.sty
doc/beamerug-guidelines.tex
CHANGELOG.md
CHANGELOG.md
base/beamerbasefont.sty
doc/emulation-examples/beamerexample-prosper.tex
doc/beamerthemeexamplebase.tex
doc/emulation-examples/beamerexample-prosper.tex
doc/examples/a-conference-talk/beamerexample-conference-talk.tex
doc/examples/a-lecture/beamerexample-lecture-style.tex
doc/solutions/conference-talks/conference-ornate-20min.de.tex
doc/solutions/conference-talks/conference-ornate-20min.en.tex
doc/solutions/conference-talks/conference-ornate-20min.fr.tex
doc/solutions/generic-talks/generic-ornate-15min-45min.de.tex
doc/solutions/generic-talks/generic-ornate-15min-45min.en.tex
doc/solutions/generic-talks/generic-ornate-15min-45min.fr.tex
doc/solutions/short-talks/speaker_introduction-ornate-2min.de.tex
doc/solutions/short-talks/speaker_introduction-ornate-2min.en.tex
doc/solutions/short-talks/speaker_introduction-ornate-2min.fr.tex
base/beamerbaselocalstructure.sty
base/beamerbaselocalstructure.sty
doc/beamerug-globalstructure.tex
doc/beamerug-elements.tex
CHANGELOG.md
base/themes/inner/beamerinnerthemeinmargin.sty
CHANGELOG.md
base/beamerbaseoverlay.sty
doc/beamerug-animations.tex
base/beamerbasenotes.sty
base/beamerbasetwoscreens.sty
doc/beamerug-notes.tex
doc/beamerug-twoscreens.tex
base/beamerbasenotes.sty
base/beamerbasetwoscreens.sty
doc/beamerug-notes.tex
doc/beamerug-twoscreens.tex
doc/beamerug-notes.tex
doc/beamerug-twoscreens.tex
base/beamerbasenotes.sty
base/beamerbasetwoscreens.sty
base/beamer.cls
doc/beamerug-animations.tex
CHANGELOG.md
base/beamerbaselocalstructure.sty
doc/beamerug-color.tex
doc/beamerug-introduction.tex
CHANGELOG.md
base/beamerbasenotes.sty
doc/beamerug-installation.tex
doc/beamerug-nonpresentation.tex
doc/beamerug-nonpresentation.tex
doc/beamerug-animations.tex
doc/beamerug-localstructure.tex
CHANGELOG.md
base/themes/outer/beamerouterthemedefault.sty
base/themes/outer/beamerouterthemeshadow.sty
base/themes/outer/beamerouterthemesmoothbars.sty
base/themes/outer/beamerouterthemesmoothtree.sty
base/themes/inner/beamerinnerthemeinmargin.sty
doc/beamerug-frames.tex
base/themes/outer/beamerouterthemedefault.sty
doc/beameruserguide.tex
doc/beamerug-interaction.tex
doc/beamerug-tutorial.tex
doc/beamerug-frames.tex
doc/beamerug-frames.tex
doc/beamerug-frames.tex
doc/beamerug-frames.tex
base/beamerbasecolor.sty
CHANGELOG.md
base/beamerbasenotes.sty
base/beamerbasearticle.sty
base/beamerbasecolor.sty
base/themes/color/beamercolorthemedefault.sty
base/themes/outer/beamerouterthemeinfolines.sty
base/themes/outer/beamerouterthememiniframes.sty
base/themes/outer/beamerouterthemesplit.sty
base/themes/inner/beamerinnerthemerounded.sty
doc/beamerug-frames.tex
base/themes/outer/beamerouterthemeinfolines.sty
base/themes/outer/beamerouterthememiniframes.sty
base/themes/outer/beamerouterthemesplit.sty
base/themes/font/beamerfontthemedefault.sty
base/themes/color/beamercolorthemedefault.sty
doc/beamerug-globalstructure.tex
doc/beamerug-globalstructure.tex
doc/beamerug-frames.tex
base/beamerbaseauxtemplates.sty
base/themes/outer/beamerouterthemeinfolines.sty
base/beamerbaseauxtemplates.sty
base/themes/outer/beamerouterthemeinfolines.sty

Is there any better to get such a list without duplicates?

P.S. My main OS is mac OS 11.6.1, but I've also fedora, ubuntu and scientific linux avaiable in case it is easier on any of them

Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

2 comment threads

Version control belongs on Software Development (3 comments)
Operating system? (4 comments)

2 answers

+3
−0

One can use sort -u to eliminate the duplicate entries and create a unique list:

git whatchanged --author=samcarter --no-commit-id --name-only | sort -u 
Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

+1
−0

You could take the list you have, then sort it and remove redundant lines.

Sorting programs come with the OS nowadays. I've had to do such things occasionally, so I created a program to eliminate adjacent redundant lines from a text file.

For example, I copied your GIT output above into the file a.txt, then ran these commands:

C:\temp>sortf a.txt b.txt

C:\temp>elim_redun b.txt c.txt
240 lines read, 165 lines removed in 43 repeat blocks, 75 lines written.

These commands result in the file c.txt, which is the list of files you are looking for.

This whole process, including running GIT, could easily be canned into a script. It could clean up the intermediate files, too.

maybe better suited as a comment as the mentioned programs don't seem to be publicly available?

I was answering with a concept, not necessarily a particular program. A program like elim_redun, above, is so trivial I didn't think it was worth elaborating on. I just checked, and its source code is a whopping 74 lines long. That includes comments and blank lines.

Nonetheless, elim_redun and lots of other stuff is included in the full runtime release at www.embedinc.com/pic/dload.htm. I just refreshed it to make sure the exact same version I'm running on my system is available there.

That software is open source, too. The software release includes a script to grab copies of our GitHub repositories, and includes other tools for building everything from the source code that will then be local on your system.

Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment thread

... maybe better suited as a comment as the mentioned programs don't seem to be publicly available? (1 comment)

Sign up to answer this question »

This community is part of the Codidact network. We have other communities too — take a look!

You can also join us in chat!

Want to advertise this community? Use our templates!

Like what we're doing? Support us! Donate