Skip to content

Instantly share code, notes, and snippets.

@LucasLevino
Last active November 17, 2023 19:20
Show Gist options
  • Select an option

  • Save LucasLevino/38efa583fd322b0790df1a9d82d4300b to your computer and use it in GitHub Desktop.

Select an option

Save LucasLevino/38efa583fd322b0790df1a9d82d4300b to your computer and use it in GitHub Desktop.
Comando de personalização do git
commands in shell
git config --global core.editor code
git config --global --edit
add in .gitconfig
[alias]
c = !git add --all && git commit -m
nb = !git checkout -b
p = !git push -u origin
s = !git status -s
[MacOS] l = !git log --pretty=format:'%C(blue)%h%C(red)%d - %C(white)%s - %C(red)%cn, %C(green)%cr'
[Windows] l = !git log --pretty=format:'%C(blue)%h%C(red)%d - %C(white)%s - %C(blue)%cn, %C(green)%cr'
t = tag -a $1 -m $1
graph = !git log --graph
search = !git log --grep=
amend = !git add --all && git commit --amend --no-edit
count = !git shortlog -s --grep
[push]
followTags = true
in shell
#$ git c "your commit here"
#
#$ git nb feature_branch_name
#
#$ git p feature_branch_name
@MichaelCurrin

MichaelCurrin commented Aug 7, 2020

Copy link
Copy Markdown

I'm looking at public gists and found yours.

Thanks for sharing

BTW you can simply things like this as it will work the same

s = "status -s"
l = "log --pretty=format:'%C(blue)%h%C(red)%d - %C(white)%s - %C(cian)%cn, %C(green)%cr'"

The first c one uses shell &&, so you'll have to keep that as is.

I don't know if the quotes are always needed but based on my linter I put them in. Note that single quotes on the outside will actually break the command when you run it so use double quotes.

@MichaelCurrin

Copy link
Copy Markdown

Also I am curious what sh -t is for?

I have an alias which takes an argument and uses it. See $1. If that's what you're after then you can start with tag and not sh

clone-s = "! [ $# -ne 1 ] && echo 'Args: REPO' || git clone git@github.com:MichaelCurrin/$1.git"

e.g.

git clone-s os-genesis

@MichaelCurrin

Copy link
Copy Markdown

It also gives me an error message if I leave off the arg

@LucasLevino

Copy link
Copy Markdown
Author

sorry, is sh -c this a command for create a tag to git repository

@MichaelCurrin

MichaelCurrin commented Aug 8, 2020

Copy link
Copy Markdown

Ok thanks.

The ! already invokes the shell so you don't need to add sh too.

And you are doing plain git command so can leave off !.

So you can do

t = tag -a $1 -m $1

@LucasLevino

Copy link
Copy Markdown
Author

thanks, i'll change it

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