Code Monkey home page Code Monkey logo

fancy-git's Introduction

All Contributors

PRs Welcome made-with-bash MIT Licence GitHub forks GitHub 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...

001 002 003 004 005 006 007

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

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 โ›๏ธ

  • 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 [email protected] or simply create an issue here.
I'll be happy to help you.

Donate_with_PayPal

fancy-git's People

Contributors

diogocavilha avatar allcontributors[bot] avatar pandel avatar marvinkweyu avatar foundjem avatar ohrafaelmartins avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.