This seems like a bug. Do you not see those lines in the output? What version do you have? Perhaps my issue is particular to my file's history. I was tracing the history of a. I finally figured that out and added the file back.
When I include --name-status in the git log command, I see two A. I wonder if perhaps the. That's the only thing I can think of that I could possibly argue ought to look like a file having been added and never deleted and yet still not being present. Would be interesting to try and figure out an MCVE, then figure out whether it's a Git bug, and if not, whether it's possible to tweak my answer to handle your case. Akif Akif 4, 1 1 gold badge 34 34 silver badges 39 39 bronze badges.
The primary upvoted solution did not work for me, but this one did. This solution worked for me. The accepted solution didn't. Same for me, this solution worked well while the accepted answer didn't. Thank you very much, great tip! Note that pattern matching works too here.
This one worked for me too. The upvoted answer included a bunch of commits that didn't actually touched the file for some reason. Anyway, thanks Akif — Kenny Horna. Community Bot 1 1 1 silver badge.
BrentFoust It's a pitty I cannot test that Nice suggestion. But adding a space before the single quote didn't help. Neither did a space before the closing brace. Try: git log --stat grep file. Eric Woodruff Eric Woodruff 6, 3 3 gold badges 33 33 silver badges 33 33 bronze badges. Grep on its own is not going to be very useful, since it will give only the file name that was deleted. I had the file name wrong and this helped me find the correct file.
The Overflow Blog. Podcast Explaining the semiconductor shortage, and how it might end. Does ES6 make JavaScript frameworks obsolete? A few prebuilt option values are available for you to use. In addition, the short , full , and fuller values show the output in roughly the same format but with less or more information, respectively:.
The most interesting option value is format , which allows you to specify your own log output format. You may be wondering what the difference is between author and committer. The author is the person who originally wrote the work, whereas the committer is the person who last applied the work. The oneline and format option values are particularly useful with another log option called --graph.
This type of output will become more interesting as we go through branching and merging in the next chapter. Show commits in an alternate format. Option values include oneline, short, full, fuller, and format where you specify your own format. In addition to output-formatting options, git log takes a number of useful limiting options; that is, options that let you show only a subset of commits. However, the time-limiting options such as --since and --until are very useful.
For example, this command gets the list of commits made in the last two weeks:. You can also filter the list to commits that match some search criteria.
The --author option allows you to filter on a specific author, and the --grep option lets you search for keywords in the commit messages. You can specify more than one instance of both the --author and --grep search criteria, which will limit the commit output to commits that match any of the --author patterns and any of the --grep patterns; however, adding the --all-match option further limits the output to just those commits that match all --grep patterns.
For instance, if you wanted to find the last commit that added or removed a reference to a specific function, you could call:. The last really useful option to pass to git log as a filter is a path. If you specify a directory or file name, you can limit the log output to commits that introduced a change to those files. This is always the last option and is generally preceded by double dashes -- to separate the paths from the options:.
Web Development Website Optimization Websites need to load fast to make visitors happy. Try Tower - For Free. I deleted a file and committed the deletion You made a commit deleting a file, but then realized you wanted to keep the file around after all? I committed the deletion and then I did more commits If you deleted a file, committed, then continued work and did more commits, only to find that deleting the file was a mistake, Git still has you covered!
Get our popular Git Cheat Sheet for free! New content and updates. Yes, send me the cheat sheet and sign me up for the Tower newsletter. It's free, it's sent infrequently, you can unsubscribe any time. I have read and accept the Privacy Policy. I understand that I can unsubscribe at any time.
0コメント