Show in a format designed for machine consumption. (before git status -porcelain, commit 6f15787, September 2009, git 1.7.0,īefore git push -porcelain, commit 1965ff7, June 2009, git 1.6.4): Perhaps the meaning of -porcelain here is "produce output suitable for consumption by porcelain scripts".Īnd that could be supported by the very first case of " -porcelain option" introduction The full symbolic names of the refs will be given.Īs John Glassmyer proposes in the comments: The output status line for each ref will be tab-separated and sent to stdout instead of stderr. That reflects the need, for git users, to using porcelain commands in their scripts!īut only with stable output (with -porcelain)Īs commented by william-berg, the same goes for git push! -porcelain The " -z -porcelain" format is much more so, and I would recommend it to anyone scripting around "git status" So yeah, while -porcelain by itself is stable and scriptable, it is perhaps not the most friendly to parsers. The idea was to prevent people from scripting around -short, because it was never intended to be stable. Some people wanted a scriptable status output, too, so I slapped a " -porcelain" on the same format that turns off configurable features like relative pathnames and colorizing, and makes an implicit promise that we won't make further changes to the format. The "short-status" form is meant for human eyeballs, and was designed by Junio. This is similar to the short output, but will remain stable across git versions and regardless of user configuration. Give the output in an easy-to-parse format for scripts. Note: A porcelain command can have a -porcelain option.įor instance: git status -porcelain, which designates an output meant to be parsed. See " How do I programmatically determine if there are uncommitted changes?" as an example to using plumbing commands instead of porcelain ones. The interface to Porcelain commands on the other hand are subject to change in order to improve the end user experience. The interface (input, output, set of options and the semantics) to these low-level commands are meant to be a lot more stable than Porcelain level commands, because these commands are primarily for scripted use. However, you can use the output of a porcelain command which has a -porcelain option in script (see below), like: git status -porcelainĪlthough git includes its own porcelain layer, its low-level commands are sufficient to support development of alternative porcelains. That is key: if you script, you should use if possible plumbing commands, with stable outputs. Sometimes your forget you added a file and might commit something you didn't want.More importantly, the term "porcelain" applies to high-level commands, with output: I would do a git commit -a which will take all files in a repository new or changed and add/commit in one swoop. Remember, I can only commit files and changes to files that I have added first. Normally you would would do git add to add all the files, but what if I made 20 files and don't want to write git add for all 20 files before doing a git commit. This will show you untracked files (newly added files) and any files that have had changes made to them. If you add files or change files in a repository. "Git commit -a" Will automatically add any files that were changed to the "Staging" area as well as commit them. If I wanted to push those changes to a remote repository, I would do "git push" From there I can do a git commit, which will commit the changes to my local repository. This will take my changes and add them to a "staging" area. I can do "Git add file1", "Git add file2" etc etc.I made changes to 5 of them and created 5 more.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |