Scripts and aliases that make git easier to use
Sets up a CMake C++ project named project in a subfolder named project and commits it to a new git repo.
Displays the differences between two branches using difftool.
Displays the differences for path between the working directory and HEAD all at once using difftool rather than one at a time.
Fetches and fast-forwards (if possible) all branches in the repo.
Fetches and fast-forwards (if possible) all branches in the repo and all its submodules.
For all git repositories in any subdirectories, pulls all branches and tags from all remotes.
Pulls the current branch and updates the submodules if the local branch is behind and hasn't diverged.
Creates a temporary branch named wip/${user}/${timestamp} from uncommitted changes and pushes it to origin so that it can be referenced elsewhere.
Rebases all branches matching pattern onto branch.
For example, I do this a lot: git-rebase-all develop feature
Removes a submodule from the repo completely.
Resets the current branch to commit and retains the removed commits in a new branch named branch.
Note: The new branch name defaults to wip/${branch}-saved-${timestamp} if none is provided.
Shows the differences between commit and its predecessor using difftool.
Checks all git repositories in subdirectories, and list the ones with changes.
Unifies two branches such that commits in branch1 are followed by commits in branch2.
Runs uncrustify on all modified or added c/cpp/h files in the working tree.
Fetches and fast-forwards all branches and submodules, and then updates all submodules.
Pulls branch and rebases the current branch on top of it.
Stages and commits a submodule update with a descriptive commit message showing the subproject's commit hash.
Sets up a Julia project named project in a subfolder named project and commits it to a new git repo.
Sets up a node.js NPM project named project in a subfolder named project and commits it to a new git repo.
Sets up a TypeScript node.js project with NPM in the current directory and commits it to a new git repo. Includes TypeScript, tsx, vitest, and VS Code debug configuration.
Sets up a node.js PNPM project named project in a subfolder named project and commits it to a new git repo. Includes a GitHub CI workflow.
Sets up a TypeScript node.js project with PNPM in the current directory and commits it to a new git repo. Includes TypeScript, tsx, vitest, VS Code debug configuration, and a GitHub CI workflow.
Sets up a Rust project named project in a subfolder named project and commits it to a new git repo.
Iterates through all subdirectories with Git repositories and performs a pull and submodule update on each one. Skips the 3rdParty directory. Useful for batch updating multiple projects.
Example Git configuration file with custom settings including:
- Core settings (preload index, file system cache, editor configuration)
- Git LFS filter configuration
- User identity settings
- Diff and merge tool settings (Araxis Merge)
- Custom git aliases for all the scripts in this repository
To use this configuration, copy it to your user directory and adjust the paths and user information as needed.
Example NPM configuration file with settings for initializing new npm projects, including:
- Author email
- Author name
- Author URL
- License type
- Project version
Git commands with options that I use a lot.
- alias grevert='git checkout --': Undoes any unstaged changes to the specified files
- alias gsquash='git rebase -i': Rewrites history
- alias gunstage='git reset HEAD': Unstages the specified files
- alias ggraph='git log --graph ...: Draws the branch graph the way that I like it
- alias glog='git log ...: Formats the log the way that I like it
- alias gamend='git commit --amend --no-edit': No-fuss amended commits