From 34ee04642361cfa31f8fca0c49bdefaca9ed4892 Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Sat, 11 Sep 2021 18:45:30 +0300 Subject: [PATCH] Some git scripts work. - git skel alias. Maintain a skeleton directory and the alias copies them over and adds them. For now, Markdown and reStructuredText README files, a .gitignore and a starting VERSION file. - Nicer commit messages with git-bump. - git-license to generate a LICENSE.txt file and add it. --- .config/git/skel/.gitignore | 1 + .config/git/skel/README.md | 12 ++++++++++++ .config/git/skel/README.rst | 16 ++++++++++++++++ .config/git/skel/VERSION | 1 + Documents/bin/git-bump | 3 +++ Documents/bin/git-license | 5 +++++ Documents/bin/git-skel | 8 ++++++++ 7 files changed, 46 insertions(+) create mode 120000 .config/git/skel/.gitignore create mode 100644 .config/git/skel/README.md create mode 100644 .config/git/skel/README.rst create mode 100644 .config/git/skel/VERSION create mode 100755 Documents/bin/git-license create mode 100755 Documents/bin/git-skel diff --git a/.config/git/skel/.gitignore b/.config/git/skel/.gitignore new file mode 120000 index 0000000..99ce66c --- /dev/null +++ b/.config/git/skel/.gitignore @@ -0,0 +1 @@ +../ignore \ No newline at end of file diff --git a/.config/git/skel/README.md b/.config/git/skel/README.md new file mode 100644 index 0000000..15a742d --- /dev/null +++ b/.config/git/skel/README.md @@ -0,0 +1,12 @@ +# PROJECT_NAME + +## License + +This software is licensed under the MIT license (see `LICENSE.txt`). + +## Author Information + +Nimrod Adar, [contact me](mailto:nimrod@shore.co.il) or visit my +[website](https://www.shore.co.il/). Patches are welcome via +[`git send-email`](http://git-scm.com/book/en/v2/Git-Commands-Email). The repository +is located at: <https://git.shore.co.il/explore/>. diff --git a/.config/git/skel/README.rst b/.config/git/skel/README.rst new file mode 100644 index 0000000..c8db619 --- /dev/null +++ b/.config/git/skel/README.rst @@ -0,0 +1,16 @@ +PROJECT_NAME +############ + +License +------- + +This software is licensed under the AGPL 3+ license (see the :code:`LICENSE.txt` +file). + +Author +------ + +Nimrod Adar, `contact me <nimrod@shore.co.il>`_ or visit my `website +<https://www.shore.co.il/>`_. Patches are welcome via `git send-email +<http://git-scm.com/book/en/v2/Git-Commands-Email>`_. The repository is located +at: https://git.shore.co.il/nimrod/. diff --git a/.config/git/skel/VERSION b/.config/git/skel/VERSION new file mode 100644 index 0000000..6e8bf73 --- /dev/null +++ b/.config/git/skel/VERSION @@ -0,0 +1 @@ +0.1.0 diff --git a/Documents/bin/git-bump b/Documents/bin/git-bump index 5320c8e..d16d28c 100755 --- a/Documents/bin/git-bump +++ b/Documents/bin/git-bump @@ -1,7 +1,10 @@ #!/bin/sh set -eu +OLD_VERSION="$(cat VERSION)" semver-bump "$1-release" +NEW_VERSION="$(cat VERSION)" git commit VERSION -m "Bumped $1 version." +git commit --only VERSION --message "Bump version: $OLD_VERSION → $NEW_VERSION" git tag-version git push --follow-tags diff --git a/Documents/bin/git-license b/Documents/bin/git-license new file mode 100755 index 0000000..a14e27d --- /dev/null +++ b/Documents/bin/git-license @@ -0,0 +1,5 @@ +#!/bin/sh +set -eu + +license "$@" > LICENSE.txt +git add LICENSE.txt diff --git a/Documents/bin/git-skel b/Documents/bin/git-skel new file mode 100755 index 0000000..d0262ba --- /dev/null +++ b/Documents/bin/git-skel @@ -0,0 +1,8 @@ +#!/bin/sh +set -eu + +for i in "$@" +do + cp --dereference --target-directory=./ "$HOME/.config/git/skel/$i" +done +git add "$@" -- GitLab