This feature provides a set of utilities for working with Git repositories.
The following aliases are included: ./alias.json
"features": {
"ghcr.io/tomgrv/devcontainer-features/gitutils:1": {
"version": "latest"
}
}| Options Id | Description | Type | Default Value |
|---|---|---|---|
| version | The version of GitUtils to install. | string | latest |
Installs a collection of Git utilities. Installs the git-flow extension and sets up Git configuration to use it. Adds shortcuts to the git command for easier use of git-flow commands.
Additionally, the feature installs the git-flow extension and sets up the Git configuration to use it.
Shortcuts are also added to the git command to make it easier to use the git-flow commands:
git betais a shortcut forgit flow release startgit hfixis a shortcut forgit flow hotfix startgit prodis a shortcut forgit flow release finishandgit flow hotfix finish
These shortcuts work in conjunction with the gitversion utility to automatically update the version number of the application.
The feature includes the following interactive utilities:
git fixup- Amend the specified commit with current changes and rebasegit align- Align the current branch with its remote counterpart.git degit <repository> [directory]- Download and extract a repository from GitHub, GitLab, or Bitbucket.git fix date [options] [<commit>]- Fix commit dates and times in git history. Options include rescheduling commits on specific days of week outside certain time ranges.git fixup [--force|<commit>]- Amend the specified commit with current changes and rebase.git forall <command>- Execute a command for all files in the repository.git getcommit [--force|<commit>]- Get the commit to fixup.git integrate- Integrate modifications from the remote repository.git movetags- Move tags to the nearest commit with the same message in the current branch.git release-beta- Start a new release branch using Git Flow.git release-hotfix- Start a new hotfix branch using Git Flow.git release-prod- Finish a release or hotfix branch using Git Flow.git setrights- Set permissions for files and directories according to best practices.git unset <prefix> [--local|--global|--system]- Unset all Git config keys starting with the given prefix.
The following aliases are provided to enhance your Git workflow:
git amend- Amend the last commit with the current changes.git beta- Start a new release branch using Git Flow.git cleanup- Stash all changes, clean the working directory, and apply the stash.git co <message>- Commit with the provided message.git conflict- List files with merge conflicts.git continue- Continue the rebase process after resolving conflicts.git crush- Stash all changes, reset to the upstream branch, and apply the stash.git edit- Amend the last commit and edit the commit message.git fixMode- Apply the reverse diff of the current changes.git fixable- List commits that can be fixed up.git forceable- List commits that can be force-pushed.git go <message>- Commit all changes with the provided message.git hfix- Start a new hotfix branch using Git Flow.git histo- Show the commit history from the last merge.git ignore <file>- Add the specified file to.gitignoreand remove it from the index.git initFrom <repo> <dir>- Clone a repository and set up branches.git isChanged <file>- Check if the specified file has changed.git isDirty <file>- Check if the specified file has uncommitted changes.git isFixup- Check if the last commit is a fixup commit.git isRebase- Check if a rebase is in progress.git pn- Push without running pre-push hooks.git prod- Finish a release or hotfix branch using Git Flow.git recallId <key>- Set the Git user name and email to the author of the last commit.git renameTag <old> <new>- Rename a tag.git stack- Amend the last commit without changing the commit message.git sync- Fetch and merge changes from the upstream branch.git undo- Undo the last commit, keeping the changes in the working directory.
The feature also includes the following VS Code customizations:
-
Extensions:
donjayamanne.githistorytomblind.scm-buttons-vscodemhutchie.git-grapharturock.gitstashgithub.copilotgithub.copilot-chatgithub.vscode-github-actionsgitHub.vscode-pull-request-githubgithub.codespaceswaderyan.gitblame
-
Settings:
explorer.excludeGitIgnore:truegit.autorefresh:true
The git fix date command allows you to correct commit dates and times in your git history. It provides advanced options to reschedule commits that fall outside specific time ranges for certain days of the week, while maintaining the sequential order of commits.
# Basic usage with default values (reschedule Mon-Fri 08:00-17:00 to 06:00/20:00)
# The command will display a plan and ask for confirmation
git fix date -f [ < commit-sha > ]
# Dry-run mode to preview changes without applying them (no confirmation needed)
git fix date -d [ < commit-sha > ]
# Reschedule commits with custom options
git fix date -r < days > -s < start > -e < end > -b < before > -a < after > [ < commit-sha > ]-f- Force mode: allow overwriting pushed history-p- Push changes after rewriting history-d- Dry-run mode: display change plan without applying changes or asking for confirmation-r <days>- Days of week to reschedule (default:1,2,3,4,5for Mon-Fri; 0=Sunday, 6=Saturday)-s <start>- Start time for rescheduling (default:08:00, HH:MM format)-e <end>- End time for rescheduling (default:17:00, HH:MM format)-b <before>- Time to move first half commits to (default:06:00, HH:MM format)-a <after>- Time to move second half commits to (default:20:00, HH:MM format)
When run without options, the command will:
- Display a change plan showing all commits that will be modified
- Ask for confirmation before proceeding
- Reschedule commits on weekdays (Monday-Friday)
- Target commits between 08:00 and 17:00
- Move first half (08:00-12:30) to 06:00
- Move second half (12:30-17:00) to 20:00
git fix date -dOutput:
=== Change Plan ===
a1b2c3d | 2024-03-04 09:00:00 → 2024-03-04 06:00:00 | Monday morning work
e4f5g6h | 2024-03-04 14:00:00 → 2024-03-04 20:00:00 | Monday afternoon work
=== End of Change Plan ===
Dry run complete. No changes were made.
git fix date -fThe command will display the change plan and prompt:
This will rewrite git history. Make sure you understand the consequences.
Do you want to proceed? (y/N)
Reschedule all Sunday commits between 8:00 and 20:00:
- Commits in the first half (8:00-14:00) will be moved to 7:30 on the same day
- Commits in the second half (14:00-20:00) will be moved to 20:30 on the same day
git fix date -f -r 0 -s 08:00 -e 20:00 -b 07:30 -a 20:30- The sequential order of commits is always preserved
- Only the time is modified, never the date
- The command uses
git filter-branchto rewrite history - Use
-fflag carefully as it allows overwriting pushed history
If you have a feature that you would like to add to this repository, please open an issue or submit a pull request.