Skip to content

Commit eb03165

Browse files
committed
README: Add lots of new stuff, and some rewriting.
* Make first section a separate 'Overview' section under the title, and split it in to subsections. * Update missing features section. * Add Install/Invocation, Testing and Authors/History sections. License stuff will come in as a separate commit.
1 parent d06fbab commit eb03165

1 file changed

Lines changed: 87 additions & 18 deletions

File tree

‎README.md‎

Lines changed: 87 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,102 @@
11
git-commit-filetree
2-
-------------------
2+
===================
3+
4+
Overview
5+
--------
6+
7+
`git-commit-filetree` is a git command that takes an arbitrary tree
8+
of files (typically not part of a Git repository's working copy) and
9+
commits that file tree to the end of a given branch. It can be run as a
10+
standalone script, or installed as a git command.
311

4-
`git-commit-filetree` is a git command that takes an arbitrary tree of
5-
files and creates a commit of them appended to a given branch. It can
6-
also be run as a standalone script.
12+
Usage: `git commit-filetree <branch> <path>`
713

8-
Usage:
14+
### Motivation
915

10-
git commit-filetree <branch> <path>
16+
This command allows you to do builds on one branch of a repo and then
17+
commit the build output to a separate branch of the same repo. This
18+
avoids making a second clone of the repo with its own working copy,
19+
doing the commit there, and then moving the new commit from the second
20+
repo to the first.
1121

12-
The main purpose of this command is to allow you to commit builds made
13-
on one branch of a repo to another branch without having to set up a
14-
second repo and working copy.
22+
### Usage with Github.io
1523

16-
A classic use case is when you're using your own build system to a
17-
static website to be hosted on `github.io`. You would check out your
18-
repo's `master` branch, build your site into an output directory (e.g.,
19-
`output/site`) and then run `git commit-filetree gh-pages output/site`
20-
to commit the new version of the site to the `gh-pages` branch. Then a
21-
`git push --all` will upload both the updated source and updated build
22-
and github.io will start serving the new version of the site on the
23-
`gh-pages` branch.
24+
A classic use case is when you're using your own build system to create
25+
a static website to be hosted on
26+
[github.io](https://help.github.com/categories/github-pages-basics/).
27+
The procedure is as follows:
28+
29+
* Check out your repo's `master` branch (or whichever branch contains your
30+
source code and build system).
31+
* Build your site into an output directory (e.g., `./_site`).
32+
* Run `git commit-filetree gh-pages ./_site`. This will update the `gh-pages`
33+
branch with the new version of the site under the `./_site` directory.
34+
* `git push --all` to upload your latest source and generated site to Github.
35+
* Github.io will start serving the new version of the site from the
36+
`gh-pages` branch.
2437

2538
Missing Features
2639
----------------
2740

2841
The following features are still missing from this version of the
2942
program.
3043

44+
* Test fixes for Git 2.5.x (or perhaps all of Git 2.x) due to a
45+
format change git log's `%d` format.
3146
* Update the reflog after doing the commit.
3247
* Add the ability to specify a commit message.
33-
* A manual page
48+
(This should allow a token to substitute the current HEAD commit at
49+
the time git-commit-filetree was run, e.g., `%h`.)
50+
* Manual page.
51+
52+
Installation and Invocation
53+
---------------------------
54+
55+
The script can be invoked in one of two ways. In both cases,
56+
you'll need to ensure that the executable bit is set.
57+
58+
* Directly from the command line. E.g.,
59+
`./git-commit-filetree mybranch myfiles`.
60+
* Copy the script to any directory in your path and invoke it through
61+
`git commit-filetree mybranch myfiles`.
62+
63+
The second method will allow you to use `git` parameters before the
64+
`commit-filetree` command, such as `-C`, `--git-dir`, `--work-tree`, and
65+
so on.
66+
67+
### Usage with Windows
68+
69+
The standard Git installation for Windows includes the Bash shell, and
70+
so it appears that Windows has everything necessary to run this command.
71+
However, we've not tried it. If you wish to get it working, we would
72+
appreciate any feedback you could offer.
73+
74+
Testing
75+
-------
76+
77+
The test framework uses shell scripts that generate output conforming to
78+
the [TAP Specification](https://testanything.org/tap-specification.html).
79+
80+
The top-level `Test` script will run the tests using perl's `prove`
81+
program, which is part of the standard install on most GNU/Linux
82+
systems. However, you should be able to use other TAP test harnesses
83+
should the need arise. If you have any difficulty, please feel free to
84+
contact the authors for help.
85+
86+
Authors and History
87+
-------------------
88+
89+
* Curt J. Sampson <<cjs@cynic.net>>
90+
* Nishant Rodrigues <<nishantjr@gmail.com>>
91+
92+
cjs and Nishant together came up with the general idea.
93+
94+
Nishant did the heavy lifting to figure out exactly how to use the
95+
Git plumbing to get the job done. (It turned out to be a little more
96+
complex than we'd thought due to Git's propensity to want to stage
97+
things through an index file rather than just directly create a tree
98+
object. Perhaps that's for performance reasons in the more general case
99+
of git use.)
100+
101+
cjs wrote the test framework and tests, and the `git-commit-filetree`
102+
command framework (error handling, usage messages, etc.).

0 commit comments

Comments
 (0)