summaryrefslogtreecommitdiffstats
path: root/web/input/doc/faq/git.md
diff options
context:
space:
mode:
Diffstat (limited to 'web/input/doc/faq/git.md')
-rw-r--r--web/input/doc/faq/git.md26
1 files changed, 13 insertions, 13 deletions
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
43someone else, everything that follows can happen offline. If you have push 43someone else, everything that follows can happen offline. If you have push
44access to the Nagios Plugins repository, run the command: 44access to the Nagios Plugins repository, run the command:
45 45
46 git clone git@github.com:nagios-plugins/nagios-plugins.git 46 $ git clone git@github.com:nagios-plugins/nagios-plugins.git
47 47
48If you just want a local copy or wish to clone it to your workstation, you can 48If you just want a local copy or wish to clone it to your workstation, you can
49run this command instead: 49run this command instead:
50 50
51 git clone git://github.com/nagios-plugins/nagios-plugins.git 51 $ git clone git://github.com/nagios-plugins/nagios-plugins.git
52 52
53This will create a directory called `nagios-plugins` with all the `master` 53This will create a directory called `nagios-plugins` with all the `master`
54code and history (this is roughly equivalent to CVS/SVN `HEAD`). Change 54code and history (this is roughly equivalent to CVS/SVN `HEAD`). Change
@@ -58,7 +58,7 @@ directory to `nagios-plugins`.
58 58
59You can edit the files in the working area. To check the status, use: 59You can edit the files in the working area. To check the status, use:
60 60
61 git status 61 $ git status
62 62
63This will show a list of changes in the working directory. Newly made changes 63This will show a list of changes in the working directory. Newly made changes
64appear in red, while changes added to the index are shown in green. You can 64appear 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
74difference between HEAD and the index) with **git diff --staged**, and then 74difference between HEAD and the index) with **git diff --staged**, and then
75commit them with: 75commit them with:
76 76
77 git commit 77 $ git commit
78 78
79Add a comment (you *have* read the [Development Guidelines][guidelines], 79Add a comment (you *have* read the [Development Guidelines][guidelines],
80right? :-)). This commit will be local (affecting only your own repository), 80right? :-)). 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
83accessible clone of your local repository). If the change is from a 83accessible clone of your local repository). If the change is from a
84contributor, set the author at commit time: 84contributor, set the author at commit time:
85 85
86 git commit --author="Jane Doe <jane@example.com>" 86 $ git commit --author="Jane Doe <jane@example.com>"
87 87
88If you realize that you forgot something in your commit and haven’t pushed it 88If you realize that you forgot something in your commit and haven’t pushed it
89yet to a remote repository, you can amend your last commit with **git commit 89yet 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
97have already staged the changes you will have to unstage them. As indicated 97have already staged the changes you will have to unstage them. As indicated
98in the **git status** message you can do so with the following command: 98in the **git status** message you can do so with the following command:
99 99
100 git reset HEAD <file> 100 $ git reset HEAD <file>
101 101
102Then you can revert unstaged changes with: 102Then you can revert unstaged changes with:
103 103
104 git checkout <file> 104 $ git checkout <file>
105 105
106If you have already committed changes locally and need to undo your commit(s), 106If you have already committed changes locally and need to undo your commit(s),
107you can use **git reset**. First find the commit names with **git log** and 107you can use **git reset**. First find the commit names with **git log** and
108then do either one of these: To keep local modifications (you can commit them 108then do either one of these: To keep local modifications (you can commit them
109again, stash them, etc.) 109again, stash them, etc.)
110 110
111 git reset --soft <commit> 111 $ git reset --soft <commit>
112 112
113Note that for the purpose of “re-doing” the last commit, **git commit 113Note that for the purpose of “re-doing” the last commit, **git commit
114--amend** will be much easier than a reset/commit with the same end result. 114--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
116command you may be able to recover them with **git reflog** and **git checkout 116command you may be able to recover them with **git reflog** and **git checkout
117<commit\>**): 117<commit\>**):
118 118
119 git reset --hard <file> 119 $ git reset --hard <file>
120 120
121Do not reset changes that have already been pushed to remote repositories as 121Do not reset changes that have already been pushed to remote repositories as
122this will cause non-linear updates. If you do so, all developers using those 122this 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
131cloned from the main Git repository, this command will do a fetch and then 131cloned from the main Git repository, this command will do a fetch and then
132merge any new changes: 132merge any new changes:
133 133
134 git pull 134 $ git pull
135 135
136You can also merge changes from any other fork of the repository. This 136You can also merge changes from any other fork of the repository. This
137usually happens if someone asks you to pull from his own repo for some fix or 137usually happens if someone asks you to pull from his own repo for some fix or
138enhancements. Together with **--no-commit**, you will have a chance to review 138enhancements. Together with **--no-commit**, you will have a chance to review
139the changes and make any relevant correction before the merge. Example: 139the changes and make any relevant correction before the merge. Example:
140 140
141 git pull --no-commit git://example.com/path/to/repo.git master 141 $ git pull --no-commit git://example.com/path/to/repo.git master
142 142
143## Merging Back to the Main Repository 143## Merging Back to the Main Repository
144 144
@@ -146,7 +146,7 @@ Once you’re done with your commits, and after pulling from the main
146repository, you can push your changes back to it. If you cloned using the 146repository, you can push your changes back to it. If you cloned using the
147*push* URL, this command will push the master branch: 147*push* URL, this command will push the master branch:
148 148
149 git push 149 $ git push
150 150
151It you’re trying to push something that would generate merge conflicts, the 151It you’re trying to push something that would generate merge conflicts, the
152push will be rejected. You will have to do a pull first, fix any conflicts 152push 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
154them from someone else or published them somewhere) you can rebase to avoid a 154them from someone else or published them somewhere) you can rebase to avoid a
155merge: 155merge:
156 156
157 git pull --rebase 157 $ git pull --rebase
158 158
159Like a merge, this may generate conflicts and let you fix them, but instead of 159Like a merge, this may generate conflicts and let you fix them, but instead of
160creating a merge commit on top of the others, it will undo your commits, 160creating a merge commit on top of the others, it will undo your commits,