Skip to content

Instantly share code, notes, and snippets.

@mohamedhafezqo
Last active November 9, 2021 12:51
Show Gist options
  • Save mohamedhafezqo/0ada2a9a116d30d38276de463d7cae95 to your computer and use it in GitHub Desktop.
Save mohamedhafezqo/0ada2a9a116d30d38276de463d7cae95 to your computer and use it in GitHub Desktop.
My Simply Git Aliases That Make Me Breakthrough

Git Configurations

Command Description
git config --global user.name "firstName lastName" make sure to provide your actual name
git config --global user.email "[email protected]" make sure to provide your actual email address
git config --global color.ui true Display the command-line UI in color
git config --global push.default current When pushing code, always push only your current branch to a branch of the same name
git config --global fetch.prune true Automatically prune deleted branches from your local copy when you fetch (or pull)
git config --global core.autocrlf false Tell git not to mess with your line endings
git config --global log.decorate short Show branch names with git log
git config --global core.preloadindex true Enable parallel index preload for operations like git diff
git config --global core.fscache true Git for Windows offers a filesystem cache which accelerates operations in many cases, after an initial "warm-up"
git config --global core.symlinks false Ignore symlinks: ( If you are having problems with brew (re)installation: As per -> https://github.com/Homebrew/homebrew-php/issues/4167`, you might want to run git config --global --unset core.symlinks)`
git config --global core.longpaths true Allow for longer path file names (Windows API has a default limitation of 260 characters or fewer for file paths)
git config --global pack.useSparse true `When true, git will default to using the --sparse option in git pack-objects when the --revs option is present. This algorithm only walks trees that appear in paths that introduce new objects. This can have significant performance benefits when computing a pack to send a small change. However, it is possible that extra objects are added to the pack-file if the included commits contain certain types of direct renames.
`

Git Aliases

git config --global alias.ck checkout => git ck

git config --global alias.ct commit => git ct

git config --global alias.st status => git st

git config --global alias.pl pull => git pl

git config --global alias.ps push => git ps

alias gbr="git branch | grep -v "master" | xargs git branch -D" => gbr for Remove all your local git branches but keep master

Use SSH to avoid password prompts when you push code

Start the below steps in your terminal:

  • ssh-keygen
  • cat ~/.ssh/id_rsa.pub
  • Copy result to your account in GitHub, Bitbucket, and so on
@mohamedhafezqo
Copy link
Author

Good article to another usage for SSH Passwordless Login Using SSH Keygen in 5 Easy Steps
SSH Passwordless Login Using SSH Keygen in 5 Easy Steps

@mohamedhafezqo
Copy link
Author

@mohamedhafezqo
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment