git-log

View full file diff of `x` commits of a single file's history (that's hosted in git)

£可爱£侵袭症+ 提交于 2019-12-07 10:03:53
问题 Say I have a file in git called filex.code , and I want to see the full code of the last x versions of that file with each changed section highlighted -- all in one place. So an x -paned commit history of filex.code , almost as if I were doing an x -paned diff, but viewing historical versions rather than merging from different branches. The greater x , the better. Crossplatform would be great, but any of the Big Three works. Being able to edit the latest version would also be great, but read

Ignore files in git log -p

六月ゝ 毕业季﹏ 提交于 2019-12-07 09:53:24
问题 I'm trying to summarize my work on a project. The problem is that I do not want to include test files in the output of git log --patch . The files are in a single directory called mtest ; however, that folder also contains test suite code that I do want to show. Test files, which I want to exclude, have extension mscx or xml , so I would want the filter to work based on that. I have looked at Making 'git log' ignore changes for certain paths but this looks like it excludes commits that

git – order commits introducing “TODO”s by date

微笑、不失礼 提交于 2019-12-07 07:05:38
问题 I want to find commits that introduced added a "TODO" or "FIXME" comment and order them by date. I know that git log -G'TODO|FIXME' will show me commits that contain either comment and I could do something like git log --format='%ci' -G'TODO|FIXME' | cut -d' ' -f 1 But this will not respect that it should only be commits introducing such comments. Does anyone know how I can find only commits introducing such comments and order them by date? If the actual SHA-1 was included in that list, that

How to fix GIT error : HEAD: invalid reflog entry xxxxxxxxxxxxxxxx

感情迁移 提交于 2019-12-07 05:19:32
问题 I have met an error before(GIT error: object file is empty) Then I used the method mentioned in how to fix GIT error: object file is empty? After I updated the HEAD pointer to a good object, it does work .but when I restart the machine ,the same error(object file is empty) occured. I tried find . -type f -empty -delete to delete all the empty files and type git fsck --full then the new error occured.(GIT error: HEAD: invalid reflog entry xxxxxxxxxxxxxxxx) Is there anything wrong with my GIT?

How to list only version tags with git-log?

江枫思渺然 提交于 2019-12-07 04:26:24
I want to create a (latex) table of tags and theirs messages straight out of git, therefor I need to get all tags that match a pattern like: /^v([0-9]|\.)*/ or so. How to do this? My attempt: git log --all --tags --grep="^v([0-9]|\.)*" --pretty=format:"%d & %s & %b" fails and returns nothing (tested on the linux kernel source tree). $ git for-each-ref --format='%(objectname)' \ 'refs/tags/v.*' 'refs/tags/v[0-9]*' | \ xargs -n 1 git log -1 --pretty=format:"%d & %s & %b" 来源: https://stackoverflow.com/questions/19848120/how-to-list-only-version-tags-with-git-log

Git: how to analyze code that has a multi-file history?

喜夏-厌秋 提交于 2019-12-07 01:55:16
问题 I'm about to move a ton of files around in an existing project. Before I do this, I'd like to have a firm grasp on some techniques used to analyze code that has a multi-file history. How can I use git to ask: "where did this line of code come from?" when the content has moved through multiple files in it's life time? I know git doesn't track renames explicitly (for good reason) so it seems like I should be able to ask this, I'm just not sure how. If there are method's to visualize this that'd

Limit Git Diff to one or more functions?

非 Y 不嫁゛ 提交于 2019-12-06 19:41:37
问题 I set *.py diff=python in .git/info/attributes . So Git knows where function boundaries. git diff -W can even make sure the whole function is shown. But is there a way to limit the output of a git diff to just a particular function (or more than one)? (Failing that, I guess it's awk...) EDIT This would also be useful for git log and git rev-list : don't show me every commit that modifies views.py, show me commits that modify a certain function in it. (Yes, in an ideal world, views.py wouldn't

Why is a stash represented as 2 commits?

我怕爱的太早我们不能终老 提交于 2019-12-06 17:26:39
问题 When stashing some changes, Git creates two separate commits, 'WIP on branch' and 'index on branch': $ git log --graph --all * commit 98aac13303ca086580c1ec9ccba5fe26c2a8ef3c |\ Merge: 7d99786 82c5c76 | | Author: Tieme <my@email.com> | | Date: Wed Nov 19 09:58:35 2014 +0100 | | | | WIP on development: 7d99786 Last real commit | | | * commit 82c5c763357c401135675a39bfabf9b7f6805815 |/ Author: Tieme <my@email.com> | Date: Wed Nov 19 09:58:35 2014 +0100 | | index on development: 7d99786 Last

how do i identify files/directories that were added or removed in a git commit?

北城以北 提交于 2019-12-06 17:04:08
问题 I need to write a script that incrementally keeps track of files and directories added and removed from a git repo. I have tried to use: git log -n1 --pretty="format:" --name-only But that only tells me which files were committed. It does not specify if it was added or removed. Any ideas? 回答1: The option you're looking for is --name-status . Like --name-only it's actually a git-diff option; git-log accepts those to determine how it'll display patches. git log -n 1 --pretty=oneline --name

Get commit where merged branch forked from (with intermediate merge)

旧巷老猫 提交于 2019-12-06 12:34:43
问题 Lets use the latest available git 2.16.2 and tig 2.3.3. cd /tmp && mkdir fit && cd fit git init touch m1 && git add m1 && git commit -m "master 1" touch m2 && git add m2 && git commit -m "master 2" git checkout -b develop touch d1 && git add d1 && git commit -m "develop 1" git checkout master touch m3 && git add m3 && git commit -m "master 3" git checkout develop git merge master --no-edit touch d2 && git add d2 && git commit -m "develop 2" touch d3 && git add d3 && git commit -m "develop 3"