jlegrone / git-config

High-level git aliases to improve your workflow
https://jlegrone.github.io/git-config
MIT License
11 stars 3 forks source link

@jlegrone/git-config

npm version Build Status Known Vulnerabilities

Commitizen friendly semantic-release

Install

$ npm install --global @jlegrone/git-config

Uninstall

$ npm uninstall --global @jlegrone/git-config

Non-NPM Install

$ git clone https://github.com/jlegrone/git-config.git
$ cd git-config
$ git config --global --add include.path "$PWD/src/jlegrone.gitconfig"

Usage

To view the source for an alias, type

$ git help <alias>

Available Aliases

git aliases

List all available git aliases.


git branches

List all remote branches, ordered by last commit date.


git contains <commit-hash>

List all local and remote branches containing a given commit hash.

$ git contains 27395436382cd897fd957635bd42cf78788f11b1
* feature/add-docs
  master
  remotes/origin/master

git up

Rebase the current branch onto origin/develop.

Rebases onto origin/master if no develop branch is present.

Caution: This command rewrites history.


git start <feature>

Checkout a new branch based on origin/develop, prefixed with feature.

Uses origin/master if no develop branch is present.

$ git start user-service
# now on branch feature/user-service

git hotfix <bug>

Checkout a new branch based origin/master, prefixed with hotfix.

Requires a master branch.

$ git hotfix missing-translations
# now on branch hotfix/missing-translations

git wip

Create a "work in progress" commit with all (staged and unstaged) changes.


git undo

Undo the latest commit. The contents of that commit will remain as staged changes.


git amend

Amend the latest commit to include all (staged and unstaged) changes.

Caution: This command rewrites history.


git fixup <commit-hash>

Add staged changes to the specified commit.

Caution: This command rewrites history, and may introduce conflicts during rebase.

$ git add .
$ git fixup 27395436382cd897fd957635bd42cf78788f11b1

git reword <commit-hash>

Edit the commit message for the specified commit.

Caution: This command rewrites history.

$ git reword 27395436382cd897fd957635bd42cf78788f11b1

git edit

Perform an interactive rebase starting from the specified commit.

Accepts all options that can be passed to git-rebase.

Caution: This command rewrites history, and may introduce conflicts during rebase.

$ git edit 27395436382cd897fd957635bd42cf78788f11b1

git publish

Push the current branch to the remote origin, and set it to track the upstream branch.


git unpublish

Remove the current branch from the remote origin.


git pushf

Force push to the upstream branch, but receive a warning if new commits were added to the remote since your last checkout.

For more information, see http://weiqingtoh.github.io/force-with-lease/.

Accepts all options that can be passed to git-push.


git cleanup

Delete local branches that have been fully merged into master or develop.


git cb <branch-name>

Checkout a new branch. Shorthand for git checkout -b <branch-name>.

Accepts all options that can be passed to git-checkout.

$ git cb test/my-proof-of-concept
# now on branch test/my-proof-of-concept

git l

Show an abridged git log output, with one line per commit.

Accepts all options that can be passed to git-log.

$ git l
6b1768a 2017-08-09 (tag: v1.3.3) Merge pull request #9 from jlegrone/feature/re-enable-release [GitHub]
1b0b519 2017-08-09 chore(travis): install dev dependencies again in post_success hook [Jacob LeGrone]
4b5cb73 2017-08-09 Merge pull request #8 from jlegrone/feature/fix-missing-dep [GitHub]
e5695bc 2017-08-09 fix(install): update to working validate-git-version [Jacob LeGrone]
3fab789 2017-08-09 test(travis): install production dependencies only [Jacob LeGrone]
...

git s

Show an abridged git status output which only includes files changed.

Accepts all options that can be passed to git-status.

$ git s
M  README.md
 M commitizen.config.js
 M src/jlegrone.gitconfig