Kasun Siyambalapitiya
Kasun Siyambalapitiya

Reputation: 4413

how to get git log without the commit message

I want to get the git log only with the no of additions and deletionswithout the author, date,commit hash and the commit message details, for identifying how many lines of codes have been modified. Currently I am being able to remove all the above except the commit message by using the following bash command

git log origin/master --numstat --since="2 weeks ago"  --no-merges | egrep -v 'Author|Date|commit

The output of the above is as follows

Adding test case for IDENTITY-3591

4 0 modules/integration/tests-common/admin-clients/pom.xml 129 0 modules/integration/tests-common/admin-clients/src/main/java/org/wso2/identity/integration/common/clients/challenge/questions/mgt/ChallengeQuestionMgtAdminClient.java 223 0 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/challenge/questions/mgt/ChallengeQuestionManagementAdminServiceTestCase.java 2 0 modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml 5 0 pom.xml

Updating SAML metadata version

10 10 modules/p2-profile-gen/pom.xml 2 2 pom.xml

Updating dependency versions

4 4 pom.xml

Changing value of the version tag in carbon.xml to be picked from the project version

1 0 modules/distribution/pom.xml

Fixing carbon.identity.auth.version name

1 1 pom.xml

Downgrading identity.data.publisher.oauth.version to avoid test failures

1 1 pom.xml

Update dependencies to latest versions.

10 8 pom.xml

Adding dependencies for each version property to be used by maven version plugin.

29 28 modules/p2-profile-gen/pom.xml 175 4 pom.xml

How can I get the output without the commit message? Thanks in advance

Upvotes: 24

Views: 21564

Answers (2)

Sajib Khan
Sajib Khan

Reputation: 24184

You can do:

$ git log --stat --format="%H"

You can customize it as you needed. Here

$ git log --pretty=format:"%h %ad- %s [%an]"

Here:
- %ad = author date
- %an = author name
- %h = commit hash (short)
- %H = commit hash (full)
- %s = subject
- %d = ref names

Git's pretty docs lists all placeholders.

Upvotes: 44

bskr
bskr

Reputation: 181

Try this

git log --numstat --format=

Upvotes: 18

Related Questions