• Stars
    star
    313
  • Rank 133,714 (Top 3 %)
  • Language
    Python
  • License
    Other
  • Created over 10 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Browse, search and open Git repositories in Alfred

Git Repos Workflow for Alfred

Browse, search and open Git repositories from within Alfred.

Download

Get the workflow from GitHub releases.

Versions 2.2+ are not compatible with Alfred 3 and earlier.

For Alfred 3, download version 2.1.2, and for Alfred 2, please download version 1.7.

Usage

This workflow requires some configuration before use. See Configuration for details.

  • repos [<query>] β€” Show a list of your Git repos filtered by <query>
    • ↩ β€” Open selected repo in app_default (see configuration)
    • ⌘+↩ β€” Open selected repo in app_cmd (see configuration)
    • βŒ₯+↩ β€” Open selected repo in app_alt (requires configuration)
    • ^+↩ β€” Open selected repo in app_ctrl (requires configuration)
    • ⇧+↩ β€” Open selected repo in app_shift (requires configuration)
    • fn+↩ β€” Open selected repo in app_fn (requires configuration)
    • ⌘βŒ₯+↩ β€” Open selected repo in app_cmd_alt (requires configuration)
    • ⌘βŒ₯⇧+↩ β€” Open selected repo in app_cmd_alt_shift (requires configuration)
    • etc.
    • etc.
  • reposettings β€” Open settings.json in default JSON editor
  • reposupdate β€” Force workflow to update its cached list of repositories. (By default, the list will only be updatedβ€”in the backgroundβ€”every 3 hours.)
  • reposhelp β€” Open this file in your browser

Configuration

Before you can use this workflow, you have to configure one or more folders in which the workflow should search for Git repos. The workflow uses find to search for .git directories, so you shouldn't add huge directory trees to it, and use the depth option to restrict the search depth. Typically, a depth of 2 will be what you want (i.e. search within subdirectories of specified directory, but no lower). Add directories to search to the search_dir array in settings.json (see below).

The default settings.json file looks like this:

{
  "app_default": "Finder",               // ↩ to open in this/these app(s)
  "app_cmd": "Terminal",                 // ⌘+↩ to open in this/these app(s)
  "app_alt": null,                       // βŒ₯+↩ to open in this/these app(s)
  "app_ctrl": null,                      // ^+↩ to open in this/these app(s)
  "app_shift": null,                     // ⇧+↩ to open in this/these app(s)
  "app_fn": null,                        // fn+↩ to open in this/these app(s)
  "global_exclude_patterns": [],         // Exclude from all searches
  "search_dirs": [
    {
      "path": "~/delete/this/example",   // Path to search. ~/ is expanded
      "depth": 2,                        // Search subdirs of `path`
      "name_for_parent": 1,              // Name Alfred entry after parent of `.git`. 2 = grandparent of `.git` etc.
      "excludes": [                      // Excludes specific to this path
        "tmp",                           // Directories named `tmp`
        "bad/smell/*"                    // Subdirs of `bad/smell` directory
      ]
    }
  ]
}

This is my settings.json:

{
  "app_alt": "iTerm",
  "app_cmd": "Finder",
  "app_cmd_alt": [
    "VSCodium", 
    "Finder", 
    "SourceTree", 
    "iTerm"
  ],
  "app_ctrl": "SourceTree", 
  "app_default": "VSCodium", 
  "app_shift": "Browser", 
  "global_exclude_patterns": [], 
  "search_dirs": [
    {
      "depth": 3, 
      "path": "~/Code"
    }, 
    {
      "path": "~/Sites"
    },
    {
      "path": "~/src/git.deanishe.net/deanishe"
    }, 
    {
      "path": "~/src/github.com/deanishe"
    }
  ]
}

Note: If you specify Browser, Safari, Google Chrome, Webkit or Firefox as an application, it will be passed the remote repo URL, not the local filepath. Browser will open the URL in your default browser.

You can also change the default update interval (3h) in the workflow's configuration sheet in Alfred Preferences. Change the UPDATE_EVERY_MINS workflow variable to suit your needs.

Search Directories

Each entry in the search_dirs list must be a mapping.

Only path is required. depth will default to 2 if not specified. excludes are globbing patterns, like in .gitignore.

name_for_parent defaults to 1, which means the entry in Alfred's results should be named after the directory containing the .git directory. If you want Alfred to show the name of the grandparent, set name_for_parent to 2 etc.

This is useful if your projects are structured, for example, like this and src is the actual repo:

Code
  Project_1
    src
    other_stuff
  Project_2
    src
    other_stuff
  …
  …

Set name_for_parent to 2, and Project_1, Project_2 etc. will be shown in Alfred, not src, src, src…

Open in Applications

The applications specified by the app_XYZ options are all called using open -a AppName path/to/directory. You can configure any application that can open a directory in this manner. Some recommendations are Sublime Text, SourceTree, GitHub or iTerm.

The meta app Browser will open the repo's remote/origin URL in your default browser. Other recognised browsers are Safari, Google Chrome, Firefox and WebKit.

Note: As you can see from my settings.json, you can also set an app_XYZ value to an array of applications to open the selected repo in more than one app at once:

…
  "app_cmd": ["Finder", "Sublime Text", "SourceTree", "iTerm"],
…

In versions 3+ (i.e. in Alfred 4), you can also arbitrarily combine modifiers to give yourself many more options:

"app_cmd_alt": "Finder",
"app_shift_alt_cmd": "VSCodium",
"app_cmd_fn_alt": "Oni",
etc.
etc.

Modifiers may be specified in any order. The only requirements are that the key must start with app_ and the modifiers must be separated by _.

You can also use β†’ on a result to access Alfred's default File Actions menu.

License, Thanks

This workflow is released under the MIT Licence.

It uses the Alfred-Workflow and docopt libraries (both MIT Licence).

The icon is by Jason Long, from git-scm.com, released under the Creative Commons Attribution 3.0 Unported Licence.

More Repositories

1

alfred-workflow

Full-featured library for writing Alfred 3 & 4 workflows
Python
2,970
star
2

awgo

Go library for Alfred 3 + 4 workflows
Go
859
star
3

alfred-convert

Convert between different units in Alfred
Python
721
star
4

zothero

Rapidly search and cite Zotero entries from Alfred
Python
477
star
5

alfred-stackexchange

Search StackOverflow.com from Alfred
Python
434
star
6

alfred-fixum

Fix Alfred 3 Python workflows affected by the Sierra/Alfred-Workflow background process bug
Python
369
star
7

alfred-ssh

Open SSH/SFTP/mosh connections from Alfred 3+
Go
356
star
8

alfred-firefox

Search and control Firefox from Alfred
Go
342
star
9

alfred-searchio

Alfred workflow to auto-suggest search results from multiple search engines and languages.
HTML
306
star
10

alfred-pwgen

Generate passwords with Alfred
Python
290
star
11

alfred-fakeum

Generate fake test data in Alfred
Python
288
star
12

alfred-gcal

View Google Calendar events in Alfred
Go
222
star
13

alfred-reddit

Browse Reddit from Alfred
Python
214
star
14

alfred-safari-assistant

Alfred 3+ workflow to search and use Safari bookmarks, history, reading list and tabs.
Go
190
star
15

alfred-vpn-manager

Manage Tunnelblick & Viscosity VPN connections from Alfred
Python
154
star
16

alfred-smartfolders

Quick access to your Smart Folders (Saved Searches) from Alfred
Python
119
star
17

alfred-fuzzy

Fuzzy search helper for Alfred 3+ workflows
Python
93
star
18

alfred-appscripts

Alfred workflow to search and run/open AppleScripts for the active application
Python
87
star
19

alfred-sublime-text

Filter and open your Sublime Text (2 and 3) project files from Alfred.
Go
73
star
20

i-sheet-you-not

Automagically turn Excel spreadsheets into Alfred 3 Workflows
Python
67
star
21

alfred-mailto

Send emails to recipients and groups from Alfred
Python
64
star
22

alfred-fuzzyfolders

Fuzzy search across folder subdirectories
Python
57
star
23

alfred-unicode

Preview Unicode characters and emoji in Alfred
Go
57
star
24

alfred-booksearch

Search Goodreads.com from Alfred
Go
56
star
25

alfred-similar-image-search

Google Image searches based on local files via Alfred
Python
50
star
26

alfred-packal-search

Search Packal.org's collection of Alfred workflows from Alfred
Python
43
star
27

alfred-services

Run macOS services from Alfred
Go
39
star
28

go-safari

Access Safari bookmarks, reading list, history and tabs (macOS)
Go
38
star
29

alfred-relative-dates

Alfred workflow to generate relative dates in different locales
Python
35
star
30

alfred-network-location

List, filter and activate network locations from within Alfred
Python
32
star
31

alfred-duden

Search the duden.de German dictionary from Alfred. With auto-suggest.
Python
32
star
32

alfred-index-demo

Demonstration of using sqlite as a search index in Alfred
Python
26
star
33

alfred-default-folder-x

Access your Default Folder X favourites and recent items in Alfred
Python
25
star
34

alfred-forklift

Filter ForkLift favourites in Alfred
Go
23
star
35

alfred-resolve-url

Alfred workflow to resolve HTTP redirects and return the canonical URL
Python
14
star
36

alfred-gifs

Say it with GIFs (and Alfred)
Python
12
star
37

bundler-icon-server

Generate PNG icons from icon fonts like Font Awesome
HTML
12
star
38

go-env

Access environment variables & populate structs from them
Go
11
star
39

alfred-errnum

Search macOS errors in Alfred 3
Python
10
star
40

alfred-mpd

Control mpd music player from Alfred 3
Python
9
star
41

go-fuzzy

Fuzzy matching & sorting for Go
Go
9
star
42

alfred-glosbe

Translate in Alfred using Glosbe.com
Python
8
star
43

CopyLink.mmBundle

MailMate Command to copy a link to the currently selected email
Python
8
star
44

alfred-transmit

Rapidly search Transmit favourites in Alfred
Go
5
star
45

alfred-bundler-python-demo

Demo Workflow showing how to use the Alfred Bundler in Python
Python
5
star
46

cookiecutter-alfred-workflow

cookiecutter template for Alfred 2 workflows
Python
4
star
47

alfred-star-ratings

Add star ratings to your files on OS X with Alfred
Python
4
star
48

alfred-excel-demo

Demo workflow showing how to use an Excel file as a data source for an Alfred Script Filter
Python
4
star
49

alfred-reminders-demo

Goto lists in Reminders.app
Python
3
star
50

bundler-icon-server-iconpacks

Icon packs for Bundler Icon Server
2
star
51

alfred-subdir-search

Alfred 2 Workflow to search subdirectories
Python
2
star
52

alfred-flixsearch

Search FlixSearch.io from Alfred 2
Python
2
star
53

www.deanishe.net

Hugo static site source
Go
1
star
54

just-a-test

Test Repo for GH API
1
star
55

alfred-workflow-dummy

A dummy repo for testing Alfred-Workflow's update functionality
Python
1
star
56

deanishe.github.io

Generated contents of www.deanishe.net
HTML
1
star