Skip to content

Instantly share code, notes, and snippets.

@iketiunn
Last active July 8, 2024 05:39
Show Gist options
  • Save iketiunn/a2750f48bee9cc0c9d0c to your computer and use it in GitHub Desktop.
Save iketiunn/a2750f48bee9cc0c9d0c to your computer and use it in GitHub Desktop.
git/git-snippet/git-flow/
[color]
ui = true
[core]
editor = vim
excludesfile = ~/.gitignore_global
[alias]
cm = commit -m
co = checkout
st = status
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
rb = !git remote update && git branch --merged | grep -Ev \"(^\\*|master|main|dev)\" | xargs git branch -d
rup = remote update -p
[format]
pretty = format:%C(auto)%h %d%Creset %s%n%Cgreen%ad%Creset %aN <%aE>%n
[user]
# enter your name & email
name = placeholer
email = placeholer@gmail.com
[push]
default = simple
[branch]
autosetuprebase = always

Setting

git config --global user.name 0w0;
git config --global user.email 0w0@users.noreply.github.com;
git config --global color.ui true;
git config --global core.editor vim;
git config --global alias.co checkout;
git config --global alias.st status;
git config --global format.pretty format:"%C(auto)%h %d%Creset %s%n%Cgreen%ad%Creset %aN <%aE>%n";
# autosetup rebase so that pulls rebase by default
git config --global branch.autosetuprebase always

Commands

Undo stage(git add)

git reset

Reset to be last one commit

git reset --hard HEAD^

rebase after merge

This command will pull and rebase keeping your merge action (not work every time due to the complicated commits)

git pull --rebase=preserve

delete remote branch

git push origin :branchName

delete all untracked files

git clean -f

clean cache file after modify .gitignore

  • specific dir git update-index --assume-unchanged dir-im-removing/
  • specific file git update-index --assume-unchanged config/database.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment