992 questions
-3
votes
0
answers
39
views
Remove Git log history [duplicate]
Issue:
Some code containing a Client ID and Client Secret was accidentally pushed to the integration branch. Although those changes have now been reverted, the issue is that multiple branches had ...
0
votes
1
answer
75
views
How to filter git log by relation of the parent commit?
I want to filter the commits shown by git log --graph, so that the commits included are either reachable only by the first parent (--first-parent) [type A] or which are not reachable, whose first ...
3
votes
1
answer
169
views
git notes in oneline git log format [duplicate]
When running git log to list commits with notes, it seems like the notes end with an extra newline.
Example output with two commits where only the second one has a note:
$ git log --pretty="%ad %...
-3
votes
1
answer
132
views
How to color a relative date placeholder in git reflog? [closed]
I want to color just the date part of the identifier git reflog --date, prints so I need to run with the --pretty option. However, there is no placeholder for the date a command is issued, even though ...
2
votes
3
answers
195
views
Why is git HEAD pointing to two branches?
The git installed on my machine always creates master when I initialize any folder as git:
PS C: \job-artifacts-and-outputs› git branch --show-current
master
So my local branch name is always master ...
2
votes
0
answers
66
views
How should I use `git log --remotes` for a specific branch?
I have a Git repository cloned from a remote repository. In my local repository, I see:
$ git branch --remotes
origin/HEAD -> origin/master
origin/master
But when I then do:
$ git log --...
0
votes
1
answer
103
views
Is there a way to compare commits for two unrelated histories? [closed]
I can run this to check logs:
git log --graph --decorate --pretty=oneline --abbrev-commit --cherry-mark --boundary --left-right 450efff0b..aa562a8b8 3f2556baf..b5e526fe6
> b5e526fe6 (HEAD -> ...
1
vote
0
answers
116
views
`git log` shows commits not upstream any branch or tag
I often watch git log --all --oneline --graph --decorate --colors to keep an eye on my rebases. Today, something rather unsettling is showing up:
* b782b84 (HEAD -> dev, origin/dev) III
* 22fe431 ...
3
votes
3
answers
227
views
How to get git log to show tags, greppably?
I've been having a surprisingly hard time getting git log to show tags. I thought I'd found the answer here, but I've just discovered that when I do
git log --tags --no-walk | grep a-tag-pattern-I'm-...
1
vote
1
answer
96
views
git log graph smart filter on branches
Since I have multiple colleagues in my team pushing out considerable amount of branches, whenever I want to disentangle my own branches I'd like to get a clear overview of only those. In summary I ...
2
votes
1
answer
66
views
How to get git log --follow to show patches for binary files like git diff
I need to follow the history of a binary file, like what I would get from git log --follow --patch textfile, but for a binary file.
For git diff it's possible to configure a specific diff tool via ....
0
votes
2
answers
69
views
Get the history of a line which could be moved across different files with git?
I find a line Footer is saved at the end of the file, with fixed length in fileA, and I want to know at which commit this line was added. Then I use
git log -L 51,51:.../FileFormat.h
And it turns out ...
1
vote
0
answers
59
views
Can I get git diff --stat to count character rather than lines added/removed?
I'm writing a patch for my code which mainly replaces contents within lines. I want the git diff --stat (and later git log --stat) to show me the numbers of characters, rather than lines, added or ...
0
votes
2
answers
59
views
"git log --oneline" with a blank line as separator
How can I show a blank line between each line on the output of git log --oneline?
2
votes
1
answer
99
views
Git log - unable to exclude commits reachable from a commit using ^ notation
I trying to build a git log command to show commits reachable from commit1 but not reachable from a set of other commits (commit2 ...). However I seem to be doing something wrong with a command to ...
0
votes
1
answer
165
views
How to grep in commits from specific author(s) with git?
How to grep in commits of specific author(s) with git (i.e., w/o piping to grep)?
I could use git log and pipe into grep, but maybe there's a better (faster?) way?
git log --author="John Doe <...
0
votes
1
answer
55
views
Enrich git log with a custom dynamic content
Is there a way in Git to have a nice commit graph like this gives,
git log --graph --oneline --all --decorate
But with additional information, which would be retrieved from a custom executable?
...
1
vote
1
answer
53
views
Using "x AND y" instead of "x OR y" when using --grep twice in git-log
I'm trying to find commits whose commit message includes both key words "x" and "y". I've tried using git log --grep="x" --grep="y", and while this does include ...
-1
votes
1
answer
89
views
Align information in a column next to graph?
git log --graph --oneline --all
is quite useful. How can I align the formatted logs to start in the same column though?
For example
git log --graph --oneline --all --format='%C(auto)%<|(15)%h %d %...
3
votes
1
answer
68
views
How to search only first line of git log messages
At day job there are some automated commits made to our git repos with a specific subject:
"Job: sync <unique-id> <timestamp>"
A script exists that finds the latest commit of ...
0
votes
1
answer
293
views
Git log using since and until shows no commits [duplicate]
We have a repository with 50k+ commits and recently when I want to filter the commits from Jan 24 to Feb 24, it doesn't show any commits but there were 1000's of commits on that month. Any idea what ...
2
votes
1
answer
94
views
git log with all commits but partial diffs
I would like a way to log certain commits and also submit path arguments so that the diff on those paths, if any, is shown for each commit as if those path arguments were supplied like git diff -- <...
0
votes
2
answers
96
views
Filter git log to find deleted file by some user
Long time ago, there was a spike that I did to try something, and then I removed it.
I don't remember when I removed it (more than a year or maybe two years ago), but it was in our codebase for two or ...
0
votes
0
answers
109
views
"git log" fails in GitLab Pipeline when using variable
I've encountered a problem while using 'git log' in one stage of my GitLab pipeline. For some reason, when I try to filter the logs using the commit SHA, it doesn't work, but ONLY when I introduce the ...
1
vote
1
answer
77
views
Why must `git log --pretty` be followed by an equal mark?
Why does:
$ git log --pretty "format:%h %s"
fatal: invalid object name 'format'.
fail but both:
git log --pretty="format:%h %s"
git log --author bob
succeed? Why is the first ...
1
vote
0
answers
39
views
git log --since will miss some commits
I have a branch that merged some merge requests from other repositories, which resulted in non-linear committed time on my branch. When I use git log --since and traverse from HEAD to the parent ...
-1
votes
1
answer
118
views
Why doesn't git log show reachable ancestors? [closed]
With git log --graph --all --oneline I have:
* G (HEAD -> main, origin/main)
...
* F
* E
* D
* C
* B
| * Z
|/
* A
But if the --all flag is omitted, then the graph is:
* G (HEAD -> main, ...
0
votes
1
answer
92
views
How to show/log all commits (and only those) from stdin?
I have a list of commits and I want git-log(1) or git-show(1) to show all of them. But
only them. Not also commits that are reachable from them.
1
vote
1
answer
123
views
How should I show only commits that declare a specific footer?
Reading through this question about extracting footers from commits, the answer left something to be desired for my specific use case. Using the suggested command (git log --format="%h %s %(...
0
votes
2
answers
194
views
Finding all changes to a block of text with git
I have a text file that I'd like to track changes with. It's a file that stores values (as well as strings and arrays) and has the following format for its entries:
NAME: some_name
UNIT: some_unit
...
1
vote
1
answer
83
views
How to list only all merges to a branch after a specific commit/datetime?
I have multiple branches (dev, release_1, release_2, etc.). A lot of merges occur. I want to see all the merges to a branch after a specific commit / datetime.
For example, in dev branch there is a ...
-2
votes
1
answer
84
views
How to get one-line commit info when using `git log -L`
git log -L:function_name:file_name can be used to get the log of all commits that touched a specific function. But it always shows the content/diff of the commit as if -p option was applied.
I have ...
1
vote
1
answer
35
views
How to search specified string which introduced by merge commit?
Is there a way to search for a specific string introduced from a merge commit?
git log -S won't work and git log -m -p | less is too slow.
To reproduce the the problem, given the setup:
git init -b a
...
0
votes
1
answer
99
views
Git Log between tags show commits from another tag
I am executing a command to get a commits between two tags:
git log --merges '7.0.8'...'7.0.9' --oneline
Apart from commits that are between these two tags, I also receive some commit that was made ...
0
votes
1
answer
92
views
Git log -p -- <file> shows a commit with no patch
I asked git to show me all the commits that modified a certain file, and it produced what I asked, except some commits show no modification to said file (and so instead only the commit hash/author/...
1
vote
0
answers
72
views
"git log --all" - show multiple stashes
While using git, I noticed that my git GUI client (Git Extensions) shows all stashes I have if "show unrelated histories" is enabled - see below screenshot.
However, when looking at "...
1
vote
1
answer
47
views
No commit history with git log --follow after renaming folder with different case
I've had troubles after renaming a folder Draft to draft on macOS.
The commands are below:
cd path/to/Draft
cd ..
git checkout main
git config core.ignorecase false
# git mv Draft draft # Failed ...
0
votes
2
answers
92
views
Git auto created a FILE with git logs inside it
While pushing my commits to the remote branch and after staging files with git add ., Git unexpectedly created a new file named h containing commit logs. I'm unsure why this happened since I hadn't ...
-2
votes
2
answers
154
views
Git log --since not working as expected for 1 day timeframe
git log --since=1.day command displaying commits from June 27th despite today being July 3rd.
I'm encountering an issue with the git log --since=1.day command in Git. According to the Git ...
0
votes
1
answer
76
views
Search git history by file content
I have a tarball from a point in time from a multi-year project. The tarball was supposedly from a particular release, and the project tags the commit corresponding to each release. However, the ...
0
votes
1
answer
54
views
Compare git branches with Cherry picked PR merged
I tried to compare 2 branches with branch strategy: branches strategy
I have a development branch named S. Some works are done in temporary branches (A1, A2, B1, B2, C1, C2) then merged into ...
1
vote
1
answer
70
views
Inconsistent git log results when filtering by directory
I’m encountering an odd behavior with git log when filtering by a specific directory. Here’s the command I’m using:
18:05:04 ~/Documents/01_repo/b2b-crm (uat)
└─▶ $ git log --name-status --oneline --...
0
votes
3
answers
101
views
Why does the number of commits shown in a git log not match with the number of commits in a git rebase -i HEAD~n?
I want to perform an interactive rebase in order to squash some commits.
The way I do this is:
use git log to search for the commits I want to squash
count the number of commits from HEAD
use git ...
1
vote
1
answer
55
views
Unable to register git `log` alias using CMD
I am trying to alias a log command using Windows CMD (using " because of Windows, see this answer):
git log --pretty=format:"%C(yellow)%h %C(red)%ad %C(brightcyan)%d %C(white)%s" --date=...
1
vote
0
answers
70
views
Show Git subtree commit history when --squash option was used
Is there any way to show only subtree history, like with git log but filtering only specific subtree's related commits?
When I add a subtree with --squash option only a merge commit is shown, but the ...
1
vote
1
answer
27
views
How can I get `git log` to append ellipsis after the commit subject line if the message body is non-empty?
E.g. suppose this is what my git history looks like:
$ git log --oneline
f9b86d3 (HEAD -> main) blah the baz
966a640 foobar the frob
ac27e4d Revert "do something special"
338ff0f do ...
0
votes
2
answers
191
views
Git log of a specific branch already merged
I'm trying to update a documentation script in Python, as my coworkers and I have recently started working with GIT.
The point I'm at and stuck with now is trying to extract a list of the names of ...
1
vote
0
answers
50
views
How to clone only a git subdirectory and get the date/time of the last commit into that subdirectory
As a (late) followup on How do I clone a subdirectory only of a Git repository?, I additionally need the date and time of the latest commit in that subdirectory. However, the --depth=1 command only ...
0
votes
1
answer
94
views
Show all files affected by a commit with git log when given only one file
I would like to git log file and have it show the full commit details, including all files affected by that commit, like git log --stat=999,999 produces.
For example, git log --stat=999,999 path/to/...
1
vote
1
answer
279
views
'git log -<number> --pretty="format:%H"' output does NOT append newline when piped into 'cat -e'
I'm creating a shell script that displays the commit IDs of the 5 last git commits of my git repository.
Name of the script file: 'git_commit.sh'
By "commit ID", I mean the full 40-character ...