mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
commit
cca7848b5b
|
|
@ -49,6 +49,7 @@ $ brew install git-extras
|
|||
- `git feature`
|
||||
- `git refactor`
|
||||
- `git bug`
|
||||
- `git promote`
|
||||
|
||||
## extras
|
||||
|
||||
|
|
@ -418,3 +419,7 @@ Set up a git repository (if one doesn't exist), add all files, and make an initi
|
|||
## git-touch [filename]
|
||||
|
||||
Call `touch` on the given file, and add it to the current index. One-step creation of new files.
|
||||
|
||||
## git-promote
|
||||
|
||||
Promotes a local topic branch to a remote tracking branch of the same name, by pushing and then setting up the `git config`.
|
||||
|
|
|
|||
12
bin/git-promote
Executable file
12
bin/git-promote
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
branch=$(git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||')
|
||||
|
||||
remote_branch=$(git branch -r | grep "origin/${branch}")
|
||||
test -z "${remote_branch}" && ( git push origin "${branch}" )
|
||||
|
||||
origin=$(git config --get "branch.${branch}.remote")
|
||||
test -z "${origin}" && ( git config --add "branch.${branch}.remote" origin )
|
||||
|
||||
merge=$(git config --get "branch.${branch}.merge")
|
||||
test -z "${merge}" && ( git config --add "branch.${branch}.merge" "refs/heads/${branch}" )
|
||||
Loading…
Reference in a new issue