logo
down
shadow

How to show total number of lines changed in git log one-line format?


How to show total number of lines changed in git log one-line format?

Content Index :

How to show total number of lines changed in git log one-line format?
Tag : git , By : user185144
Date : November 27 2020, 01:01 AM

I hope this helps . I want to add the total number of lines changed for each commit in this output: , Feel free to modify this, but it's pretty straightforward:
function gcount() {
    git diff --shortstat $1 | sed -E 's/[^[:digit:][:space:]]//g' | awk '{ print $2+$3 }'
}

git log --pretty=format:"%h" | while read hash
do
    echo "$(gcount $hash)"
done | head > a.txt

git log --pretty=format:"%cd | %cn | %h | %s" | head > b.txt

paste b.txt a.txt

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Using PV to Count lines and show total lines rather then total bytes in the pipe


Tag : linux , By : kameel
Date : March 29 2020, 07:55 AM
I hope this helps you . du comes with the -s flag to only display the total, so just do e.g. this instead:
$ du -sh /tmp | cut -f1
4.9M
$ find /tmp/ | pv >/dev/null
44.6kiB 0:00:00 [3.19MiB/s] [   <=>  
^^^^^^^

$ find /tmp/ | pv -l >/dev/null
1.24k 0:00:00 [86.5k/s] [   <=>  
^^^^^

$ find /tmp/ | wc -l
1237
^^^^

diff line-format: Show delete, new, and changed lines?


Tag : linux , By : Ravenal
Date : March 29 2020, 07:55 AM
seems to work fine The LTYPEs offered by both BSD and GNU diff are "old", "new", and "unchanged". You thus can't distinguish between "new" and "changed".
That said, to get some distinctions in your format strings, you need to fill them out correctly. In %dn, both the d and the n are consumed (the former specifying a decimal value, the n specifying that it refer to the line number, or the number of lines modified, depending on context). Thus, if you want any extra characters (such as a c, d or a), you need to add those characters after that substitution has complete.
# declaring functions to allow testing without creating files on-disk
backup () { printf '%s\n' user1:password:17002:0:99:7::: user2:password:17002:0:99:7::: user3:password:17002:0:99:7:::; }
main () { printf '%s\n' username1:password:17002:0:99:7::: user3:password:17004:0:99:7::: newUser:password:17005:0:99:7:::; }

diff \
  --unchanged-line-format=":%dnu: %L" \
  --old-line-format=":%dnd: %L" \
  --new-line-format=":%dnn: %L" \
  <(backup) <(main)

How to insert total number of lines in a new line before the first line command?


Tag : sed , By : uxn
Date : March 29 2020, 07:55 AM
I hope this helps . I have thousands of .xyz files which are chemical coordinates like this one (for instance): , You can do it as a composite command:
(wc -l < fileA && cat fileA) > outputA
mkdir output
ls *.xyz | while read filename; do
    (wc -l < $filename && cat $filename) > output/$filename
done
tee xxx < fileA | wc -l > xxx # don't do this

read and print a file line by line along with the line number and the total number of lines in each line in bash


Tag : bash , By : Vrki
Date : March 29 2020, 07:55 AM
I wish did fix the issue. I want to write a bash that it reads a file line by line as a variable and in the output it prints the total number of lines, the number of each line, and the value of each line. for example: file.txt :

Show number of changed lines per author in git


Tag : git , By : Anna
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • Why different ways to resolve conflicts cause to different conflicts?
  • Git commit API for GitHub Enterprise private repositories
  • Reverting a commit only a specific branch, while keeping the "merged data"
  • Express app is hanging on git push to Heroku
  • Does .gitignore not ignore directories that contain .git subdirectories?
  • Azure Devops development to master merge issue
  • git push -u origin master fatal: unable to update url base from redirection:
  • How to commit a file rename and its content edits separately (so git detects the rename)?
  • GitLab Visibility Settings CLI
  • Does every git tag have an associated commit id?
  • Multiple git profiles
  • Can I configure git for easier cloning from GitHub?
  • How to support multiple users/multiple GitHub accounts with the IntelliJ IDE?
  • Git branch edits lost after checkout file on master branch
  • Git is looking for a wrong SSH key
  • How to make git branch's lastest codes same to another branch?
  • Determine branch name from git commit
  • Gitlab CI - composer install on private repo
  • Storing repository meta-data in GIT
  • how to include a sub directory in a excluded directory in gitignore file?
  • Why this merge works fine (add a new file) while rebase resulted in conflict?
  • git shows it's merging the same branch into itself
  • Branching a meta layer according to Yocto branches
  • Is it good practice to commit multiple files at once?
  • Exclude submodule of a submodule
  • Server-side custom git merge driver on GitHub/Azure Repos
  • What is the difference between trunk and branch in Git?
  • Git and Bitbucket: unauthorized when pushing
  • Missing the + parameter in git push after git rebase
  • Heroku fails pushing to master branch
  • Git, how to list my recently changed files
  • Is there a way to have editorconfig settings apply in git automatically when using git add? (using WebStorm)
  • shortcut to show git diff with origin master when working on a different branch with intellij
  • git default parameter on push
  • why on git checkout it automatically adds changed files in my new branch
  • "This branch has conflicts that must be resolved" but it's already merged
  • "Does not appear to be a git repository" when trying to clone via SSH
  • Git rebase clarifications
  • Abusing Git for implementation of Event Store architecture?
  • Delete multiple branches in a single run
  • GitLab - Determine if branch is protected from terminal git command
  • Azure DevOps: Set Git branch permission for all repos in all projects
  • How to check whether a file is updated after git pull?
  • How can one in Visual Studio open another GIT-branch without need to commit changes to the current one?
  • How to pull a branch which is being created from another branch in GIT
  • Adding 'git help' for alias commands?
  • How do I show tags in a custom git log format?
  • Why does git fetch origin master:master fast forward the local branch?
  • Can I edit the main.workflow github-actions file locally?
  • In Git, how to create a branch after resolving conflicts?
  • How to unsquash pushed commit to bitbucket
  • How can I git push to aws cloud9?
  • Prevent branches from being deleted on PR completion
  • Is there a git command to beautify the output of git diff between two branches?
  • git branch workflow policy
  • Git log, show only entries since last pull
  • Git can't check out on Linux with LF a file that was stored with CRLF
  • Git: Is branching per each feature really different from working all together on the same branch?
  • How do I limit what I pull down for my gatsby site from my repo?
  • Picking only range of commits while merging into another branch in git
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com