DEV Community

Discussion on: I'm a Git Master, Ask Me Anything

Collapse
 
gonedark profile image
Jason McCreary

git-extras is pretty cool.

I don't have many aliases. Only Git command completion. I like typing the full command so I'm explicit about what I'm doing. Too often with Git you can run some shorthand and forget the underlying commands.

Here are all my aliases:

unstage: reset HEAD --
logo: log --oneline
append: commit --amend --no-edit
lola: log --graph --oneline --decorate --all
Collapse
 
jonlai profile image
Jonathan Lai

Git extras bash scripts seem to extend beyond aliases -- thanks for sharing your aliases by the way.

I'd like to start developing git bash scripts like git extras, but not on that level there yet.

Collapse
 
jonlai profile image
Jonathan Lai

Speaking of aliases and shortcuts aliases or git extras bash scripts aside.

Do you have a nice good clean shortcut to do git timestamp changes similar to git-redate (github.com/PotatoLabs/git-redate).

I find manually doing the redundant GIT_AUTHOR_DATE and GIT_COMMITTER_DATE changes for just one commit edit tedious (see stackoverflow.com/questions/454734...).

Collapse
 
jonlai profile image
Jonathan Lai

@gonedark / Jason McCreary do you have a response for my previous question about redo'ing the timestamps of old git commits?

What shortcuts do you have similar to github.com/potatolabs/git-redate?

Thread Thread
 
gonedark profile image
Jason McCreary

What is the use case for needing to change the date?

Thread Thread
 
jonlai profile image
Jonathan Lai

Various reasons. Git rebasing and merging skew with the dates, and one wants to make the timestamp of the recent commits to "look" more reasonable.

Anyhow, what I'm really looking for is a shortcut for modify git timestamps without doing the manual work of setting GIT_AUTHOR_DATE and GIT_COMMITER_DATE with stackoverflow.com/a/3896112 .

Any insights @gonedark ?

Thread Thread
 
phaberest profile image
Luca Stefano Sartori • Edited

@jonlai have you ever found a trick to get that alias to work?

My solution under zsh is

function gtime() {
    GIT_COMMITTER_DATE="$1" git commit --amend --no-edit --date "$1"
}

used as

gtime YYYY-MM-DDTHH:MM:SS

example

gtime 2020-04-22T23:10:20