Keep your bookmarks with your repository
git-bookmark init [--session=<name>] [--branch=<name>] [--gitv]
git-bookmark add [--session=<name>] [--branch=<name>] [--gitv] <url>...
git-bookmark list [--session=<name>] [--branch=<name>] [--gitv]
git-bookmark open [--session=<name>] [--branch=<name>] [--gitv] [--browser=<executable>]
git-bookmark edit [--session=<name>] [--branch=<name>] [--gitv] [--editor=<executable>] [--message=<message>]
git-bookmark -h | --help
git-bookmark --version
git-bookmark
is a simple script that doubles as a git subcommand. It makes available some commands to interact with bookmark files on a separate branch, to help to store web sessions related to it.
The bookmark file format is a simple list of line separated URLs (Although no URL is ever checked for validity). It supports empty lines, leading/trailing whitespace and # comments.
Using the packaged make install
also installs git-bk
as an alias. This lets git bk
be used for brevity sake.
The man page is available with man git-bookmark
or at the project gh pages.
You'll need to install them on your own, unless you use a recommended method for installation.
I recommend you install docopts
with:
pipx install docopts
And git shouldn't be a problem installing if you're reading this.
If you're on Arch Linux git-bookmark
is available on AUR:
You can also install it manually. We first need the source. We can get the latest release tarball on the Releases page or simply do a git clone
if we want the latest commit.
Once we've extracted the tarball (or cd'd into the repo), just run:
sudo make install
You can install the script by wget'ing it and copying it somewhere on PATH. It won't install the manpages and set the proper permissions, but it should work fine.
Alternatively you can use a bash package manager to install it, like basher or bpkg.
bpkg install qu4tro/git-bookmark -g
# or
basher install qu4tro/git-bookmark
-
-h
,--help
: Displays the help screen. -
--version
: Displays version information. -
--session=<name>
: Name of the bookmark file [default: links]. -
--branch=<name>
: Name of the branch to look for the bookmark file [default: bookmarks]. -
--editor=<executable>
: Editor to use when editing a bookmark file [default:$EDITOR
]. -
--message=<message>
: Commit message when editing. When ommited it will prompt like git does. -
--browser=<executable>
: Browser to use when opening from a bookmark file [default:$BROWSER
]. -
--gitv
: Show all of the underlyings git commands output.
Start by initializing a new branch to keep the bookmarks within:
$ git bk init
You may not like the default branch or you may want to use multiple branches. You need to initialize for any branch you use.
$ git bk init --branch=other
Initializing is optional if the branch already exists.
New bookmarks can be easily added. Each add
command is a commit on the underlying branch:
$ git bk add https://github.com/stephenmathieson/git-standup
$ git bk add https://github.com/basherpm/basher https://en.wikipedia.org/wiki/Man_page
When adding the defaults can be overriden with their respective options:
$ git bk add --branch=other --session=local http://127.0.0.1:35729/
Comments can be added inline:
$ git bk add --branch=other --session=local "http://127.0.0.1:8000/ # Server"
The bookmarks can be listed as well:
$ git bk list
https://github.com/stephenmathieson/git-standup
https://github.com/basherpm/basher
https://en.wikipedia.org/wiki/Man_page
$ git bk list --branch=other --session=local
http://127.0.0.1:35729/
http://127.0.0.1:8000/
If more manual intervention you can edit the file by hand:
$ git bk edit
By default, it uses $EDITOR
, but anything in $PATH
can be specified:
$ git bk edit --editor=cat --gitv
https://github.com/stephenmathieson/git-standup
https://github.com/basherpm/basher
https://en.wikipedia.org/wiki/Man_page
On branch bookmarks
Your branch is up to date with 'origin/bookmarks'.
nothing to commit, working tree clean
We can see here with the help of `--gitv option, that no commit is generated when no changes are made when editing.
We're here.
Finally, we've arrived to our end goal! To open the saved bookmarks in your $BROWSER
simply run:
$ git bk open
And of course, we can use any of usual options when opening:
$ git bk open --browser=echo --session=local --branch=other
http://127.0.0.1:35729/
http://127.0.0.1:8000/
git-bookmark - Copyright 2020, Xavier Francisco. Released under the MIT license.