git-log

Meaning of git log --oneline --graph output

孤者浪人 提交于 2019-12-05 08:04:46
I'm learning about relative commit references and trying to understand the following git log --oneline --graph output provided in a lesson. In the lesson it says that given HEAD points to the 9ec05ca commit, HEAD^^^ (meaning the great-grandparent commit) is the 0c5975a commit. But it seems to me 4c9749e should be the great grandparent, if each SHA is a direct descendant of the one below it. Any clarification appreciated. Commit can have more than one parent. ^ 1 means first parent. ^2 means second parent and do on. Just ^ defaults to ^1 which is first parent. Similarly ~ give access to

git diff on a bare repo

拜拜、爱过 提交于 2019-12-05 01:20:00
问题 I wanna see how much a repo changed in the last month on gitlab server side cd /path/to/my/bare/repo.git/ git --git-dir . diff --shortstat "@{1 month ago}" fatal: Unable to read log 'logs/refs/heads/master': No such file or directory However it works fine in local checkout-ed working branch. Is there a way to do this without too much hassle? To avoid X-Y problem: I wanna run statistics through hundreds of repos on a Gitlab server 回答1: Try and make sure, when diff'ing in a bare repo, to

Limit Git Diff to one or more functions?

浪尽此生 提交于 2019-12-05 00:40:54
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 be a 2000 line behemoth frequently modified by 8 different developers...) Steve Bennett Ok, thanks to

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

隐身守侯 提交于 2019-12-04 22:42:17
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? 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-status Or equivalently (minus the log header): git diff --name-status HEAD^ HEAD As isbadawi points out, you can

Get snapshot of a git repo on a particular date

守給你的承諾、 提交于 2019-12-04 22:32:40
问题 Say I have a repo with multiple banches. Is it possible to get the repo snapshot of some particular date/time using usual git foo? (We currently have code dumps every day, and I am thinking of ways to remove that) (Assuming no branches are permanently deleted, and the git commit history hasn't been played with) Edit: Interim branch merges are possible. 回答1: Beware of the @{<date>} , based on the reflog (meaning, limited by default to 90 days). See "Specifying Revisions" in git rev-parse. "git

Show all commits in a git branch since original branching point from master

不打扰是莪最后的温柔 提交于 2019-12-04 21:52:16
问题 I'm looking for a way to view all commits on active branch since branching point (and including it) and hopefully since branching from master. For example situation like: A-B-C-D (master) \ E-F (branch A) I want to get commits F, E and B while F is the HEAD. And for A-B-C-D (master) \ E-F (branch B) \ G (branch C) I want to get commits G, F, E, B in case G is current HEAD. Displaying this information with --graph option would be also great. For now I have come up with git log master^..HEAD

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

蓝咒 提交于 2019-12-04 18:43:54
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" git checkout master git merge develop --no-edit touch m4 && git add m4 && git commit -m "master 4" git

Show commit size in git log

与世无争的帅哥 提交于 2019-12-04 17:05:31
问题 How can I get commit size shown in the output of git log ? You may understand commit size as the diff between its parents and itself, or anything reasonable that tells you how big the commit is. git log has a --log-size option but its the size of the log message, not the commit itself. 回答1: The "size" of a commit can mean different things. If you mean how much disk storage it takes up... that's very tricky to tell in Git and probably unproductive. Whereas something like SVN stores commits as

What's the best practice of going GIT when upstream is 100% CVS?

本秂侑毒 提交于 2019-12-04 16:26:53
I'm curious what's the best practice of keeping your occasional contributions to an OSS project in git (e.g., on github/bitbucket/gitlab), whilst the upstream is exclusively CVS. My take is that it's very convenient to simply commit CVS/{Entries,Repository,Root} directly into git , and then at any time and from any box, you can simply checkout your git repo (w/ git ), and then update from the real upstream with cvs up , which is exactly what I do with my OpenBSD ports-readmes fork , as well as mdocml . However, I've noticed that most people are quite surprised and puzzled to see these CVS

How can I limit the log to all the descendants of a given commit?

◇◆丶佛笑我妖孽 提交于 2019-12-04 05:58:09
Given the history X-Y <- feature / A-B-C-D-E <- master I want to get the descendants of a given commit. One solution seems to be: git log --all --ancestry-path <ref>^! However, the behaviour is a bit strange: when <rev> is C , the result is CDEXY when <rev> is D or X , the result is DEXY (weird!) when <rev> is E , the result is E My understanding is that the command does not get all children of <rev> ; instead, it gets all children of parent-of(ref). Am I right? This is unintuitive, error prone, and, quite frankly, irritating. How command should I run instead, in order to limit the log to the