Download raw body.
git add equivalent – add only selected files
On Thu, Mar 06, 2025 at 05:41:24AM +0100, Sylvain wrote: > Prior to putting my website source code in a got repo for public display, I performed a little trick involving mainly mv commands in order to trim my website's folder of irrelevant content, which I restored afterwards. > > I neglected to add the *.css files, located in /doc along with a bunch of other documents. Is there a command to commit those files, and only those files, to the repo ? > > My ~/.history file has several got checkout -p doc [...] attempts that failed. Hmm. 'got add' is indeed the command you should be using. I don't see anything wrong with your general approach. Generally, adding files involves checking out a work tree (with or without the -p option, it doesn't really matter), then putting new files into this work tree and running 'got add' on them, i.e. passing the file paths you want to add to 'got add'. 'got status' should then show the relevant files in 'A' status. Now run 'got commit' to commit the new files. This also accepts filenames on the command line in case you want to limit the commit to specific files while other unrelated changes are sitting in the same work tree. Since you were asking for an equivalent to 'git add': Git's add command also performs staging functionality. Got has a separate command for this called 'got stage'. You can optionally use that too, but it is not necessary at all in this trivial use case. So there is nothing super complicated about adding new files, and it seems you were intending to perform the required steps correctly. Except for some reason the checkout -p command ran into an error, so you couldn't get a work tree. What was the error message?
git add equivalent – add only selected files