From aa96b7897b40bf1171f08d77e229ec57b2c4119a Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Sun, 12 Jan 2014 23:28:55 +0100 Subject: Documentation: Denote command lines with "$" Add a prompt sign to all command lines in code blocks. --- web/input/doc/faq/git.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'web/input/doc/faq/git.md') diff --git a/web/input/doc/faq/git.md b/web/input/doc/faq/git.md index 5503166..390b87a 100644 --- a/web/input/doc/faq/git.md +++ b/web/input/doc/faq/git.md @@ -43,12 +43,12 @@ repository, and until you want to distribute your change or merge changes from someone else, everything that follows can happen offline. If you have push access to the Nagios Plugins repository, run the command: - git clone git@github.com:nagios-plugins/nagios-plugins.git + $ git clone git@github.com:nagios-plugins/nagios-plugins.git If you just want a local copy or wish to clone it to your workstation, you can run this command instead: - git clone git://github.com/nagios-plugins/nagios-plugins.git + $ git clone git://github.com/nagios-plugins/nagios-plugins.git This will create a directory called `nagios-plugins` with all the `master` code and history (this is roughly equivalent to CVS/SVN `HEAD`). Change @@ -58,7 +58,7 @@ directory to `nagios-plugins`. You can edit the files in the working area. To check the status, use: - git status + $ git status This will show a list of changes in the working directory. Newly made changes appear in red, while changes added to the index are shown in green. You can @@ -74,7 +74,7 @@ will add the changes to the index. You can select only partial diffs with difference between HEAD and the index) with **git diff --staged**, and then commit them with: - git commit + $ git commit Add a comment (you *have* read the [Development Guidelines][guidelines], right? :-)). This commit will be local (affecting only your own repository), @@ -83,7 +83,7 @@ you (in the latter case you will most likely still push to a publicly accessible clone of your local repository). If the change is from a contributor, set the author at commit time: - git commit --author="Jane Doe " + $ git commit --author="Jane Doe " If you realize that you forgot something in your commit and haven’t pushed it yet to a remote repository, you can amend your last commit with **git commit @@ -97,18 +97,18 @@ You can revert local modifications with the following steps. First, if you have already staged the changes you will have to unstage them. As indicated in the **git status** message you can do so with the following command: - git reset HEAD + $ git reset HEAD Then you can revert unstaged changes with: - git checkout + $ git checkout If you have already committed changes locally and need to undo your commit(s), you can use **git reset**. First find the commit names with **git log** and then do either one of these: To keep local modifications (you can commit them again, stash them, etc.) - git reset --soft + $ git reset --soft Note that for the purpose of “re-doing” the last commit, **git commit --amend** will be much easier than a reset/commit with the same end result. @@ -116,7 +116,7 @@ To discard local modifications (if you lose important changes with this command you may be able to recover them with **git reflog** and **git checkout **): - git reset --hard + $ git reset --hard Do not reset changes that have already been pushed to remote repositories as this will cause non-linear updates. If you do so, all developers using those @@ -131,14 +131,14 @@ If you do, either commit them or put them aside (hint: **git stash**). If you cloned from the main Git repository, this command will do a fetch and then merge any new changes: - git pull + $ git pull You can also merge changes from any other fork of the repository. This usually happens if someone asks you to pull from his own repo for some fix or enhancements. Together with **--no-commit**, you will have a chance to review the changes and make any relevant correction before the merge. Example: - git pull --no-commit git://example.com/path/to/repo.git master + $ git pull --no-commit git://example.com/path/to/repo.git master ## Merging Back to the Main Repository @@ -146,7 +146,7 @@ Once you’re done with your commits, and after pulling from the main repository, you can push your changes back to it. If you cloned using the *push* URL, this command will push the master branch: - git push + $ git push It you’re trying to push something that would generate merge conflicts, the push will be rejected. You will have to do a pull first, fix any conflicts @@ -154,7 +154,7 @@ locally, and then push again. If your commits are local (you haven’t pulled them from someone else or published them somewhere) you can rebase to avoid a merge: - git pull --rebase + $ git pull --rebase Like a merge, this may generate conflicts and let you fix them, but instead of creating a merge commit on top of the others, it will undo your commits, -- cgit v1.2.3-74-g34f1