Git: quick fix in a new branch from master
fix = "!f() { msg=$1; branch=${msg// /_}; git checkout -b ${branch}; git add --all; git commit -m \"${msg}\"; git push --set-upstream origin ${branch}; git checkout master; }; f"
Usage:
git fix "this is a little fix"
Explanation:
f() {
msg=$1; # get first argument
branch=${msg// /_}; # normalize msg to use it as branch name
git checkout -b ${branch}; # checkout branch
git add --all; # add all file in staging area
git commit -m \"${msg}\"; # commit with message
git push --set-upstream origin ${branch}; # push to origin
git checkout master; # go back to master
};
Tada!
Written by roparz
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#