Skip to content

Repository files navigation

All Contributors

PRs Welcomemade-with-bashMIT LicenceGitHub forksGitHub stars

logo

Fancygit is a tool which works for Linux and MAC OS, that changes the terminal prompt in order to show you a few cool git informations when you're working on a git repo. It'll always keep you informed about the current branch status.

🔖 You can check out the changelog here

Installing

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

Uninstalling

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 only if you're using one of the fancy styles 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 which is placed at ~/.fancy-git/fonts/SourceCodePro+Powerline+Awesome+Regular.ttf.

Once the installation have succeeded, you can type fancygit -h to check fancygit help.

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"

Run fancygit --colors to see those suggested colors.
Run fancygit --colors-set to apply it.

I suggest you to use this scheme color because fancygit will paint the background branch, most of the time, according to the current repo status, since you're using some of the colored style.

Type fancygit -h for more information.

Overview

As a picture is worth a thousand words...

001002003004005006007

Working on a Python virtual environment?

python_venv

Styles 🎨

If you don't want to be too "fancy", you can choose using the simple style by running fancygit simple.
If you want to return to the default style (colored), you can type fancygit default.
There are a few more styles you can choose from.

Here you have a list of available styles and their corresponding command to apply.

fancygit simpleSimple

fancygit simple-double-lineSimple Double Line

fancygit humanHuman

fancygit human single lineHuman Single Line

fancygit human-darkHuman Dark

fancygit human-dark-single-lineHuman Dark Single Line

fancygit defaultDefault

fancygit double-lineDouble Line

fancygit darkDark

fancygit dark-double-lineDark Double Line

fancygit dark-col-double-lineDark Col Double Line

fancygit lightLight

fancygit light-double-lineLight Double Line

Commands

CommandDescription
fancygit -h, --helpShow this help.
fancygit -v, --versionShow the fancygit version.
fancygit updateUpdate fancygit code with the latest release from github.
fancygit configure-fontsInstall 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 --colorsShow suggested colors config in an easy way to copy and paste to apply them.
fancygit --colors-setApply the suggested colors configuration.
fancygit --disable-full-pathFancygit will show only the the directory name you are working on. Not the entire path.
fancygit --enable-full-pathFancygit will show the entire path.
fancygit --disable-show-user-at-machineFancygit will hide (user@machine) info.
fancygit --enable-show-user-at-machineFancygit will show (user@machine) info, as usual.
fancygit simpleChange prompt to the simple style.
fancygit simple-double-lineChange prompt to the simple style in double line.
fancygit defaultChange prompt to the default (colored) style. (This is the fallback style).
fancygit double-lineChange prompt to the default (colored) style in double line.
fancygit humanChange prompt to the human readable style.
fancygit human-darkChange prompt to the human readable style.
fancygit darkChange prompt to the dark style.
fancygit dark-double-lineChange prompt to the dark style in double line.
fancygit dark-col-double-lineChange prompt to the dark (colored) style in double line.
fancygit lightChange prompt to the light style.
fancygit light-double-lineChange 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? It's a much smaller command, isn't it? Ok, but what's the meaning of gpsob?

Well, here goes a little explanation:

gps + o + b
gps = git push
o = origin
b = <current-branch-name>... It will get the current branch name.

Basically, most of the fancygit aliases work this way.

AliasCommandDescription
gsgit statusShow git status.
ga <file> [<other_file>]Add files in order to commit. fileAdd a file in order to commit.
gap <file>Add part of a files in order to commit.Add a file in order to commit.
gaaAdd all files in order to commit. fileAdd all files in order to commit.
gdShow changes of a file and suggests to add it. fileClear screen and git diff
gcmgit commitStart committing.
gcmm "<message>"git commit -m "<message>"Start committing with a message.
gplgit pull. fileGit pull.
gpsgit pushGit push.
gplo <branch-name>git pull origin <branch-name> fileGit 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>.
gplobGit pull from remote current branch to local current branch. fileGit pull from remote branch to local branch.
gpsobGit push from local current branch to remote current branch. fileGit push from local branch to remote branch.
gck <file> ...git checkout -- <file> fileRollback file changes.
gckb <branch-name>git checkout <branch-name>Switch to a branch.
gckbt <branch-name>Switch to a branch with --track option. fileSwitch 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. fileRename current branch (local).
grba <new-branch-name>Rename a branch (local and remote). fileRename current branch (local and remote).
glgit logShow git log.
glpShow pretty git log. fileShow pretty git log.
gdoffind . -name "*.orig" | xargs rm -rfRemove all .orig files from project.
gfi <file>git update-index --assume-unchanged <file>Force git to ignore a file.
gurlShow git repository URL. fileShow git repository URL.
guserShow git user information. fileShow git user information.
gstgit stashCreate new stash with default message.
gstlgit stash listList all stashes.
gstmgit stash save "<message>"Create new stash with custom message.
gstwgit stash show <stash_id> fileShow stash diffs.
gstagit stash apply <stash_id> fileApply stash.
gstdgit stash drop <stash_id> fileDrop specific stash.
gg "<message>"git add --all && git commit -m "<message>" && git push fileAdd all changes, then commit and push them.
gu <file> [<other_file>]git reset HEAD <file>Remove files from staging area.
pvefileShow 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 ⛏️

  • Double line problem and general weird behavior
    System: Linux | MAC OS - reported issue.
    If you have a few more changes in your .bashrc file, be aware that . ~/.fancy-git/prompt.sh must be the last line of it.

  • 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. (git checkout -b your-branch-name or gcb your-branch-name).
  • Make your changes on the branch you've just created.
  • Commit it.
  • Push it.
  • Send your 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 diogocavilha@gmail.com or simply create an issue here.
I'll be happy to help you.

Donate_with_PayPal

About

More information about a git repo.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages