An open API service indexing awesome lists of open source software.

https://github.com/jambolo/git-helpers

Scripts and aliases that make git easier to use
https://github.com/jambolo/git-helpers

bash-script git

Last synced: 3 months ago
JSON representation

Scripts and aliases that make git easier to use

Awesome Lists containing this project

README

          

# git-helpers

Scripts and aliases that make git easier to use

## Scripts

### cpp-init-default \

Sets up a CMake C++ project named _project_ in a subfolder named _project_ and commits it to a new git repo.

### git-diff-branches \ \

Displays the differences between two branches using difftool.

### git-difftool-all [path]

Displays the differences for _path_ between the working directory and HEAD all at once using difftool rather than one at a time.

### git-ffwd

Fetches and fast-forwards (if possible) all branches in the repo.

### git-ffwd-all

Fetches and fast-forwards (if possible) all branches in the repo and all its submodules.

### git-pull-all-repos

For all git repositories in any subdirectories, pulls all branches and tags from all remotes.

### git-pull-if-needed

Pulls the current branch and updates the submodules if the local branch is behind and hasn't diverged.

### git-push-wip

Creates a temporary branch named wip/\$\{user\}/\$\{timestamp\} from uncommitted changes and pushes it to origin so that it can be referenced elsewhere.

### git-rebase-all \ \

Rebases all branches matching _pattern_ onto _branch_.

For example, I do this a lot: `git-rebase-all develop feature`

### git-remove-submodule \

Removes a submodule from the repo completely.

### git-save-commits \ [new branch]

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._

### git-showtool \

Shows the differences between _commit_ and its predecessor using difftool.

### git-status-all

Checks all git repositories in subdirectories, and list the ones with changes.

### git-sync \ \

Unifies two branches such that commits in _branch1_ are followed by commits in _branch2_.

### git-uncrustify

Runs uncrustify on all modified or added c/cpp/h files in the working tree.

### git-update-all

Fetches and fast-forwards all branches and submodules, and then updates all submodules.

### git-update-rebase \

Pulls _branch_ and rebases the current branch on top of it.

### git-update-submodule \

Stages and commits a submodule update with a descriptive commit message showing the subproject's commit hash.

### julia-init-default \

Sets up a Julia project named _project_ in a subfolder named _project_ and commits it to a new git repo.

### node-init-default \

Sets up a node.js NPM project named _project_ in a subfolder named _project_ and commits it to a new git repo.

### node-init-typescript

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.

### pnpm-init-default \

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.

### pnpm-init-typescript

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.

### rust-init-default \

Sets up a Rust project named _project_ in a subfolder named _project_ and commits it to a new git repo.

## Utility Scripts

### update-projects.sh

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.

## Configuration Files

### my-.gitconfig

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.

### my-.npmrc

Example NPM configuration file with settings for initializing new npm projects, including:

- Author email
- Author name
- Author URL
- License type
- Project version

## Aliases

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