Skip to content

Commit

Permalink
git change commit timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
copdips committed Mar 29, 2024
1 parent fdac8cc commit 0ae9ed4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/posts/2019/2019-06-19-git-cheat-sheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,24 @@ git restore --staged <file>
git reset
```

## Change commit timestamp

```bash
git rebase -i origin/main
# set 'e' to commits you want to change timestamp
# :x! to save and exit
# git will stop at the first commit marked with 'e'
git commit --amend --no-edit --date=now
# or to specify a date:
git commit --amend --no-edit --date="Wed Jun 19 14:00:00 2019 +0800"
# or to edit other fields:
git commit --amend
# :x! to save and exit
git rebase --continue
# git will stop at the next commit marked with 'e'
# continue with the same command above, till there's no more commit marked with 'e'
```

## Authentication

### With bearer token
Expand Down

0 comments on commit 0ae9ed4

Please sign in to comment.