1
0
Fork
You've already forked private-commit
0
No description
JavaScript 100%
Find a file
2020年01月20日 01:00:00 +01:00
cli-day.js Add support for rounding to day or hour 2019年02月25日 00:00:00 +00:00
cli-hour.js Add support for rounding to day or hour 2019年02月25日 00:00:00 +00:00
cli-week.js Add support for rounding to day or hour 2019年02月25日 00:00:00 +00:00
cli.js Add support for rounding to day or hour 2019年02月25日 00:00:00 +00:00
package-lock.json Initial commit 2019年02月18日 00:00:00 +00:00
package.json Release version 1.1.1 at npm 2019年11月18日 14:39:52 +01:00
Readme.md Update shell script version to use faketime 2020年01月20日 01:00:00 +01:00

private-commit

When you use git and make a commit, then the timestamp of the commit is saved. However, you eventually work at public git repositories and don't want a public protocol of your working times. This is the solution.

This small application rounds the current date down to the start of the last week/ hour/ day, sets GIT_AUTHOR_DATE and GIT_COMMITTER_DATE accordingly and runs git commit.

Installation

There are 2 ways for 2 different versions. Only use one of these two.

Install as shell alias

Install faketime and add the following to your ~/.bashrc:

phcommit() {
 local T="$(LC_ALL=en_US.utf8 date -u "+%a, %d %b %Y %H:00:00 %Z")"
 local T="$(LC_ALL=en_US.utf8 date -d"$T" "+%Y-%m-%d %H:00:00")"
 faketime -f "$T" git commit $*
}
pdcommit() {
 local T="$(LC_ALL=en_US.utf8 date -u "+%a, %d %b %Y 00:00:00 %Z")"
 local T="$(LC_ALL=en_US.utf8 date -d"$T" "+%Y-%m-%d %H:00:00")"
 faketime -f "$T" git commit $*
}
pwcommit() {
 local T="$(LC_ALL=en_US.utf8 date -u -dlast-monday "+%a, %d %b %Y %H:%M:00 %Z")"
 local T="$(LC_ALL=en_US.utf8 date -d"$T" "+%Y-%m-%d %H:00:00")"
 faketime -f "$T" git commit $*
}

Install using NPM

Clone https://codeberg.org/jonas-l/private-commit.git using git and run npm link within it.

Usage

Use p[x]commit instead of git commit to make commits. Command line parameters are passed through, so you can use p[x]commit -a and it will execute git commit -a.

Note: Replace the x

  • by for rounding to the previous monday
  • by d for rounding to the day
  • by h for rounding to the hour

Warning: There is still some logging due to the logged push events.