Skip to content

That's a simple prompt changer to show a few cool git informations about your repository on terminal. You can choose among 12 styles and enjoy all the aliases it provides you. Feel free for contributing, pull requests and issues are always welcome! ;)

License

Notifications You must be signed in to change notification settings

MaticPogacnik/fancy-git

Β 
Β 

Repository files navigation

Bash Shell

All Contributors

MIT Licence PRs Welcome made-with-bash GitHub forks GitHub stars GitHub contributors

logo

That's a prompt changer to show a few cool git informations about your repository on terminal.

πŸ”– You can check out the changelog here

Installing (Linux and MAC OS)

curl -sS https://raw.githubusercontent.com/diogocavilha/fancy-git/master/install.sh | sh

Uninstalling (Linux and MAC OS)

curl -sS https://raw.githubusercontent.com/diogocavilha/fancy-git/master/uninstall.sh | sh

After installing

  1. Change your terminal font to "SourceCodePro+Powerline+Awesome+Regular". (It's necessary for rendering the icons properly)
  2. Restart your terminal.

If you can't find the font, it's still possible to install it manually by running fancygit configure-fonts or even installing the ttf file placed at ~/.fancy-git/fonts/SourceCodePro+Powerline+Awesome+Regular.ttf.

Git suggested colors

git config --global color.ui true

git config --global color.diff.meta "yellow bold"
git config --global color.diff.old "red bold"
git config --global color.diff.new "green bold"
git config --global color.status.added "green bold"
git config --global color.status.changed "yellow"
git config --global color.status.untracked "cyan"

Command to apply it

fancygit --colors-set

I suggest you to use this scheme color because fancygit will paint the background branch or showing icon colors, most of the time, according to the current repo status. You can run the command: fancygit --colors in order to see those suggested colors.

You can always run a fancygit --help to check out the possibilities ;)

Overview

As a picture is worth a thousand words...

001 002 003 004 005 006 007

Working on a Python virtual environment?

python_venv

You can type fancygit -h or fancygit --help for more information.

Styles 🎨

If you don't want to be too "fancy" (as I don't), you can choose using the simple style. In order to change to the simple style you can type fancygit simple. And if you want to return to the default style (colored), you can type fancygit default.

There are a bit of styles you can choose from. Here you have a list of available styles and their corresponding command.

You can type fancygit -h or fancygit --help for more information.

fancygit simple Simple

fancygit simple-double-line Simple Double Line

fancygit human Human

fancygit human single line Human Single Line

fancygit human-dark Human Dark

fancygit human-dark-single-line Human Dark Single Line

fancygit default Default

fancygit double-line Double Line

fancygit dark Dark

fancygit dark-double-line Dark Double Line

fancygit dark-col-double-line

Dark Col Double Line

fancygit light Light

fancygit light-double-line Light Double Line

Commands

Command Description
fancygit -h, --help Show this help.
fancygit -v, --version Show the fancygit version.
fancygit update Update fancygit code with the latest release from github.
fancygit configure-fonts Install font in order to render icons properly. This font is good if you are using some of these styles: default, double-line, dark, dark-double-line, light, light-double-line.
fancygit --colors Show suggested colors config in an easy way to copy and paste to apply them.
fancygit --colors-set Apply the suggested colors configuration.
fancygit --full-path-disable Fancygit will show only the the directory name you are working on. Not the entire path.
fancygit --full-path-enable Fancygit will show the entire path.
fancygit simple Change prompt to the simple style.
fancygit simple-double-line Change prompt to the simple style in double line.
fancygit default Change prompt to the default (colored) style. (This is the fallback style).
fancygit double-line Change prompt to the default (colored) style in double line.
fancygit human Change prompt to the human readable style.
fancygit human-dark Change prompt to the human readable style.
fancygit dark Change prompt to the dark style.
fancygit dark-double-line Change prompt to the dark style in double line.
fancygit dark-col-double-line Change prompt to the dark (colored) style in double line.
fancygit light Change prompt to the light style.
fancygit light-double-line Change prompt to the light style in double line.

Aliases

Here we got a list of useful aliases you can use when working. They seem to be not that interesting, but believe me, after getting used to them, your productivity will increase considerably when working with git repos. For example, what if you could replace git push origin <branch-name> for gpsob? Much smaller command, isn't it?. That's is possible but what, for goodness sake, means gpsob?

Well, here goes a little explanation:

gps + o + b

gps = git push

o = origin

b = <current-branch-name>... Yes, it will get the branch you're working on.

Basically, most of the Fancy Git aliases work this way.

Alias Command Description
gs git status Show git status.
ga <file> [<other_file>] Add files in order to commit. file Add a file in order to commit.
gap <file> Add part of a files in order to commit. Add a file in order to commit.
gaa Add all files in order to commit. file Add all files in order to commit.
gd Show changes of a file and suggests to add it. file Clear screen and git diff
gcm git commit Start committing.
gcmm "<message>" git commit -m "<message>" Start committing with a message.
gpl git pull. file Git pull.
gps git push Git push.
gplo <branch-name> git pull origin <branch-name> file Git pull from <branch-name> to current local branch.
gpso <branch-name> git push origin <branch-name> Git push from current local branch to <branch-name>.
gplob Git pull from remote current branch to local current branch. file Git pull from remote branch to local branch.
gpsob Git push from local current branch to remote current branch. file Git push from local branch to remote branch.
gck <file> ... git checkout -- <file> file Rollback file changes.
gckb <branch-name> git checkout <branch-name> Switch to a branch.
gckbt <branch-name> Switch to a branch with --track option. file Switch to a branch with --track option.
gcb <branch-name> git checkout -b <branch-name> Create and switch to the new branch.
gdb <branch-name> git branch -D <branch-name> Delete a local branch.
gdbr <branch-name> git push origin --delete <branch-name> Delete a remote branch.
grb <new-branch-name> Rename a local branch. file Rename current branch (local).
grba <new-branch-name> Rename a branch (local and remote). file Rename current branch (local and remote).
gl git log Show git log.
glp Show pretty git log. file Show pretty git log.
gdof find . -name "*.orig" | xargs rm -rf Remove all .orig files from project.
gfi <file> git update-index --assume-unchanged <file> Force git to ignore a file.
gurl Show git repository URL. file Show git repository URL.
guser Show git user information. file Show git user information.
gst git stash Create new stash with default message.
gstl git stash list List all stashes.
gstm git stash save "<message>" Create new stash with custom message.
gstw git stash show <stash_id> file Show stash diffs.
gsta git stash apply <stash_id> file Apply stash.
gstd git stash drop <stash_id> file Drop specific stash.
gg "<message>" git add --all && git commit -m "<message>" && git push file Add all changes, then commit and push them.
gu <file> [<other_file>] git reset HEAD <file> Remove files from staging area.
pve file Show the current Python virtual environment name.

Advanced tweaking - override values from config.sh

If you like to tweak things more in-depth, like color values, special characters and such, you can create a new file ~/.fancy-git/config-override.sh. This file is sourced after reading the standard configuration, so that you can override any variable found in the main config.sh.

Example: You want to change the branch icon, because you are using a different console font and the icon is on a different character position inside the font. Simply create the override file and add a line like this (for sure, you will likely have changed the symbol):

branch_icon="ξ‚ "

Troubleshooting ⛏️

Problems with Konsole Terminal

System: Linux (with KDE) - reported issue.

Maybe you could face an issue related to icons rendering when using Konsole on version 18.12.1. An idea here is to update the Konsole to its latest version. So the problem might be solved ;)

Problems with grep command

System: MAC OS - reported issue.

As you can read there, the solution found is to brew install grep and adding /usr/local/opt/grep/libexec/gnubin to the PATH ahead of /usr/bin.

Problems with sed command

System: MAC OS - reported issue.

You can follow the steps as you did for grep, but this time, installing gnu-sed by running brew install gnu-sed.

Problems upgrading from v6.0.5 to a newest version

If you've just upgraded it from v6.0.5 to a newest version, you might have seeing an error, because fancygit can't find its configuration file.

You can fix that just by running fancygit --config-reset. It'll create a default configuration file and reset the fancygit state.

Contributing πŸš€

  • Give this project a star =D
  • Fork the project.
  • Create a branch in order to implement your changes. (git checkout -b your-branch-name).
  • Send a Pull Request.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Holger Pandel

πŸ’»

Marvin Kweyu

πŸ’»

Foundjem

πŸ’»

Rafael Martins

πŸ’»

If you have any problem on setting up the fancy-git, contact me at [email protected] or simply create an issue here. I'll be happy to help you.

Donate_with_PayPal

About

That's a simple prompt changer to show a few cool git informations about your repository on terminal. You can choose among 12 styles and enjoy all the aliases it provides you. Feel free for contributing, pull requests and issues are always welcome! ;)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%