Skip to content

Instantly share code, notes, and snippets.

@obar1
Forked from mikaelhadler/Git-alias.md
Last active February 10, 2023 11:33
Show Gist options
  • Save obar1/c75742f6f8b87922641401fe0b36e550 to your computer and use it in GitHub Desktop.
Save obar1/c75742f6f8b87922641401fe0b36e550 to your computer and use it in GitHub Desktop.
Add alias bash and git alias

For your alias to be insert in commands bash, you need to include that in .bashrc, so take this example and to be happy:

echo alias g=\'git\' >> .bashrc

If you have a success with this command, you can now call git with 'g' command.

Now, if you like alias git, you can create your personal alias file, take this example and edit your file ~ / .gitconfig:

[user]
	email = [email protected]
	name = Mikael Hadler
[core]
	editor = vim
[alias]
    st = status
    ac = !git add . && git commit
    acw = !git add . && git commit -m 'wip'
    ck = checkout
    cb = checkout -b
    s = switch
    cm = commit
    p = push origin
    pl = pull origin
    b = branch
    f = fetch origin
    revert = reset --hard HEAD~1
    dd = diff
    del = branch -D
    l = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit

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