Skip to content

Commit

Permalink
chore: move sample .gitconfig to .github directory
Browse files Browse the repository at this point in the history
  • Loading branch information
unicornware committed Sep 4, 2021
1 parent 05df609 commit 8089c7b
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 143 deletions.
157 changes: 157 additions & 0 deletions .github/.gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# Git Configuration
# See: http://michaelwales.com/articles/make-gitconfig-work-for-you/

# Git Helpers
[alias]
# Git add and commit - all in one step
ac = "!f() { git add .; git cm \"$@\"; }; f"

# Add new git remote
ar = "!f() { git remote add \"$0\" \"$1\"; }; f"

# Execute git branch command
b = "!f() { git branch $@; }; f"

# Delete a branch locally
bdel= "!f() { git b -D $@; }; f"

# Delete a branch remotely
bdelr= "!f() { git push origin --delete $@ --no-verify; }; f"

# Checkout branch
ch = "!f() { git checkout $@; }; f"

# Checkout and push new branch to origin
chb = "!f() { git ch -b \"$@\"; git puo \"$@\"; }; f"

# Checkout branch and pull latest version
chp = "!f() { git ch $@; git pull; }; f"

# Commit with message
cm = "!f() { git commit -S -m \"$@\"; }; f"

# Create new local repo, perform initial commit, and push
launch = "!f() { git init; git chore \"first commit\"; git b -M next; git rao $1; git puo next; }; f"

# Tell Git to start tracking branch and push to origin
puo = "!f() { git push -u origin $@ --no-verify; }; f"

# Add new remote origin
rao = "!f() { git remote add origin $@; }; f"

# Rebase branch
rb = "!f() { git rebase $@; }; f"

# Remove local .git directory
restart = "!f() { rm -rf .git; echo \"removed .git directory.\"; }; f"

# Undo last commit
ulc = "!f() { git reset HEAD~1 --soft; }; f"

# Conventional Commits
# See: https://www.conventionalcommits.org/
# See: https://github.com/angular/angular/blob/master/CONTRIBUTING.md#type
[alias]
# Changes that affect the build system or external dependencies
build = "!f() { git ac \"build: $@\"; }; f"

# Changes to our CI configuration files and scripts
ci = "!f() { git ac \"ci: $@\"; }; f"

# Changes that don't impact external users
chore = "!f() { git ac \"chore: $@\"; }; f"

# Documentation only changes
docs = "!f() { git ac \"docs: $@\"; }; f"

# New features
feat = "!f() { git ac \"feat: $@\"; }; f"

# Bug fixes
fix = "!f() { git ac \"fix: $@\"; }; f"

# Performance improvements
perf = "!f() { git ac \"perf: $@\"; }; f"

# Code improvements
refactor = "!f() { git ac \"refactor: $@\"; }; f"

# Revert past changes
revert = "!f() { git ac \"revert: $@\"; }; f"

# Changes that do not affect the meaning of the code
style = "!f() { git ac \"style: $@\"; }; f"

# Adding missing tests or correcting existing tests
test = "!f() { git ac \"test: $@\"; }; f"

# Work in progress (i.e feature implemented, but not tested)
wip = "!f() { git ac \"wip: $@\"; }; f"

# Branch Naming Conventions Aliases
[alias]
# Create a new bugfix branch and push upstream
chbb = "!f() { git chb bugfix/$@; }; f"

# Create a new hotfix branch and push upstream
chbh = "!f() { git chb hotfix/$@; }; f"

# Create a new feature branch and push upstream
chbf = "!f() { git chb feat/$@; }; f"

# Create a new release branch and push upstream
chbr = "!f() { git chb release/$@; }; f"

# Create a new support branch and push upstream
chbs = "!f() { git chb support/$@; }; f"

# Helper Aliases
[alias]
# Generate a SSH key
keygen = "!f() { ssh-keygen -t rsa -b 4096 -C \"$@\"; }; f"

# Recursively delete files matching a pattern
pdel = "!f() { find . -type f -name \"$@\" -delete; }; f"

# Generate a secret signing key
signingkey = "!f() { openssl rand -base64 32; }; f"

# Husky
[alias]
# Force push commits without running `pre-push` hook
fpnv = "!f() { git push --force --no-verify; }; f"

# Push commits without running `pre-push` hook
pnv = "!f() { git push --no-verify; }; f"

[core]
autocrlf = input
ignorecase = false

[credential]
helper = osxkeychain

[gitflow "prefix"]
feature = feat/
hotfix = hotfix/
release = release/
support = support/
versiontag = v

[init]
defaultBranch = next

[pull]
rebase = true

[tag]
forceSignAnnotated = false

[url "[email protected]:"]
insteadOf = bb:

[url "[email protected]:"]
insteadOf = gh:

[url "https://gist.github.com/"]
insteadOf = gist:
138 changes: 0 additions & 138 deletions docs/.gitconfig

This file was deleted.

11 changes: 6 additions & 5 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ well as follow our coding guidelines.

### Git Configuration

Copy the [starter Git global configuration](.gitconfig) to stay inline with our
coding guidelines, as well as begin extending your own workflow.
Copy the [starter Git global configuration](../.github/.gitconfig) to stay
inline with our coding guidelines, as well as begin extending your own workflow.

**Note**: The examples below will uses aliases from the starter config.

Expand All @@ -27,7 +27,8 @@ coding guidelines, as well as begin extending your own workflow.
1. Copy the snippet below to clone the project onto your local machine:

```zsh
git clone https://github.com/flex-development/tutils.git; cd tutils
git clone https://github.com/flex-development/tutils.git
cd tutils
yarn
```

Expand All @@ -49,7 +50,7 @@ When creating a new branch, the name should match the following format:
For example:

```zsh
git feat repo-setup
git feat repo-setup
```

will create a new branch titled `feat/repo-setup` and push it to `origin`.
Expand All @@ -76,7 +77,7 @@ Commit messages should be one of the following types:
For example:

```zsh
git chore "add eslint configuration"
git chore "add eslint configuration"
```

will produce the following commit: `chore: add eslint configuration`
Expand Down

0 comments on commit 8089c7b

Please sign in to comment.