Compare commits

...

3 commits

Author SHA1 Message Date
David O'Trakoun c3f6e20965
MIT license 2020-04-03 02:48:10 -04:00
David O'Trakoun 56675a7f7e
update with notes 2017-08-16 14:17:56 -04:00
David O'Trakoun 402c0180fb
zplug guide 2017-03-14 00:03:17 -04:00
3 changed files with 47 additions and 6 deletions

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License Copyright (c) 2020 davidosomething
Permission is hereby granted,
free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice
(including the next paragraph) shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -21,8 +21,17 @@ Here's a screenshot:
## Installation ## Installation
- Requires BASH 4+
- Add the `git-my` file somewhere in your path, e.g. `/usr/local/bin/` - Add the `git-my` file somewhere in your path, e.g. `/usr/local/bin/`
### zplug installation
Super simple if you use zplug:
```sh
zplug "davidosomething/git-my", as:command
```
## Usage ## Usage
From command line execute: From command line execute:
@ -50,5 +59,5 @@ merged into `origin/qa`.
---- ----
Copyright (c) 2015 David O'Trakoun <me@davidosomething.com> Copyright (c) 2017 David O'Trakoun <me@davidosomething.com>

21
git-my
View file

@ -1,18 +1,19 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# git-my v1.1.1 # git-my v1.1.2
# #
# Lists a user's remote branches and shows if it was merged # Lists a user's remote branches and shows if it was merged
# and/or available locally # and/or available locally.
# #
# Copyright (c) 2015 David O'Trakoun <me@davidosomething.com> # Copyright (c) 2017 David O'Trakoun <me@davidosomething.com>
#
# Requires:
# bash 4+ for readarray
# #
# Usage: # Usage:
# git my # git my
# #
set -eu
# is_repository # is_repository
# #
# Exits with error if not a git repository # Exits with error if not a git repository
@ -233,7 +234,17 @@ main() {
local remote_ref=${remote#*/} local remote_ref=${remote#*/}
git_user=$(git config --get user.name) git_user=$(git config --get user.name)
if [ -z "$git_user" ]; then
echo "ERROR: user.name is not set in git config"
exit 1
fi
git_remote=$(git config --get "remote.${remote_name}.url") git_remote=$(git config --get "remote.${remote_name}.url")
if [ -z "$git_remote" ]; then
echo "ERROR: remote.${remote_name}.url is not set"
exit 1
fi
everyones_remotes=$(get_everyones_remotes "$remote_name") everyones_remotes=$(get_everyones_remotes "$remote_name")
my_remotes=$(filter_mine "$git_user" "$everyones_remotes") my_remotes=$(filter_mine "$git_user" "$everyones_remotes")
merged_remote_branches=$(get_merged_remote_branches "$remote_name/$remote_ref") merged_remote_branches=$(get_merged_remote_branches "$remote_name/$remote_ref")