diff options
Diffstat (limited to 'documentation/getting-started/eclipse/html/getting-started/basic-commands.html')
-rw-r--r-- | documentation/getting-started/eclipse/html/getting-started/basic-commands.html | 176 |
1 files changed, 176 insertions, 0 deletions
diff --git a/documentation/getting-started/eclipse/html/getting-started/basic-commands.html b/documentation/getting-started/eclipse/html/getting-started/basic-commands.html new file mode 100644 index 0000000000..b145086974 --- /dev/null +++ b/documentation/getting-started/eclipse/html/getting-started/basic-commands.html | |||
@@ -0,0 +1,176 @@ | |||
1 | <html> | ||
2 | <head> | ||
3 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | ||
4 | <title>2.4.2. Basic Commands</title> | ||
5 | <link rel="stylesheet" type="text/css" href="../book.css"> | ||
6 | <meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> | ||
7 | <link rel="home" href="index.html" title="Getting Started With Yocto Project"> | ||
8 | <link rel="up" href="git.html" title="2.4. Git"> | ||
9 | <link rel="prev" href="repositories-tags-and-branches.html" title="2.4.1. Repositories, Tags, and Branches"> | ||
10 | <link rel="next" href="yocto-project-repositories.html" title="2.5. Yocto Project Source Repositories"> | ||
11 | </head> | ||
12 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="section" title="2.4.2. Basic Commands"> | ||
13 | <div class="titlepage"><div><div><h3 class="title"> | ||
14 | <a name="basic-commands"></a>2.4.2. Basic Commands</h3></div></div></div> | ||
15 | <p> | ||
16 | Git has an extensive set of commands that lets you manage changes | ||
17 | and perform collaboration over the life of a project. | ||
18 | Conveniently though, you can manage with a small set of basic | ||
19 | operations and workflows once you understand the basic | ||
20 | philosophy behind Git. | ||
21 | You do not have to be an expert in Git to be functional. | ||
22 | A good place to look for instruction on a minimal set of Git | ||
23 | commands is | ||
24 | <a class="ulink" href="http://git-scm.com/documentation" target="_self">here</a>. | ||
25 | </p> | ||
26 | <p> | ||
27 | If you do not know much about Git, you should educate | ||
28 | yourself by visiting the links previously mentioned. | ||
29 | </p> | ||
30 | <p> | ||
31 | The following list of Git commands briefly describes some basic | ||
32 | Git operations as a way to get started. | ||
33 | As with any set of commands, this list (in most cases) simply shows | ||
34 | the base command and omits the many arguments they support. | ||
35 | See the Git documentation for complete descriptions and strategies | ||
36 | on how to use these commands: | ||
37 | </p> | ||
38 | <div class="itemizedlist"><ul class="itemizedlist" type="disc"> | ||
39 | <li class="listitem"><p> | ||
40 | <span class="emphasis"><em><code class="filename">git init</code>:</em></span> | ||
41 | Initializes an empty Git repository. | ||
42 | You cannot use Git commands unless you have a | ||
43 | <code class="filename">.git</code> repository. | ||
44 | </p></li> | ||
45 | <li class="listitem"><p><a name="git-commands-clone"></a> | ||
46 | <span class="emphasis"><em><code class="filename">git clone</code>:</em></span> | ||
47 | Creates a local clone of a Git repository that is on | ||
48 | equal footing with a fellow developer’s Git repository | ||
49 | or an upstream repository. | ||
50 | </p></li> | ||
51 | <li class="listitem"><p> | ||
52 | <span class="emphasis"><em><code class="filename">git add</code>:</em></span> | ||
53 | Locally stages updated file contents to the index that | ||
54 | Git uses to track changes. | ||
55 | You must stage all files that have changed before you | ||
56 | can commit them. | ||
57 | </p></li> | ||
58 | <li class="listitem"><p> | ||
59 | <span class="emphasis"><em><code class="filename">git commit</code>:</em></span> | ||
60 | Creates a local "commit" that documents the changes you | ||
61 | made. | ||
62 | Only changes that have been staged can be committed. | ||
63 | Commits are used for historical purposes, for determining | ||
64 | if a maintainer of a project will allow the change, | ||
65 | and for ultimately pushing the change from your local | ||
66 | Git repository into the project’s upstream repository. | ||
67 | </p></li> | ||
68 | <li class="listitem"><p> | ||
69 | <span class="emphasis"><em><code class="filename">git status</code>:</em></span> | ||
70 | Reports any modified files that possibly need to be | ||
71 | staged and gives you a status of where you stand regarding | ||
72 | local commits as compared to the upstream repository. | ||
73 | </p></li> | ||
74 | <li class="listitem"><p> | ||
75 | <span class="emphasis"><em><code class="filename">git checkout</code> <em class="replaceable"><code>branch-name</code></em>:</em></span> | ||
76 | Changes your working branch. | ||
77 | This command is analogous to "cd". | ||
78 | </p></li> | ||
79 | <li class="listitem"><p><span class="emphasis"><em><code class="filename">git checkout –b</code> <em class="replaceable"><code>working-branch</code></em>:</em></span> | ||
80 | Creates and checks out a working branch on your local | ||
81 | machine that you can use to isolate your work. | ||
82 | It is a good idea to use local branches when adding | ||
83 | specific features or changes. | ||
84 | Using isolated branches facilitates easy removal of | ||
85 | changes if they do not work out. | ||
86 | </p></li> | ||
87 | <li class="listitem"><p><span class="emphasis"><em><code class="filename">git branch</code>:</em></span> | ||
88 | Displays the existing local branches associated with your | ||
89 | local repository. | ||
90 | The branch that you have currently checked out is noted | ||
91 | with an asterisk character. | ||
92 | </p></li> | ||
93 | <li class="listitem"><p> | ||
94 | <span class="emphasis"><em><code class="filename">git branch -D</code> <em class="replaceable"><code>branch-name</code></em>:</em></span> | ||
95 | Deletes an existing local branch. | ||
96 | You need to be in a local branch other than the one you | ||
97 | are deleting in order to delete | ||
98 | <em class="replaceable"><code>branch-name</code></em>. | ||
99 | </p></li> | ||
100 | <li class="listitem"><p> | ||
101 | <span class="emphasis"><em><code class="filename">git pull</code>:</em></span> | ||
102 | Retrieves information from an upstream Git repository | ||
103 | and places it in your local Git repository. | ||
104 | You use this command to make sure you are synchronized with | ||
105 | the repository from which you are basing changes | ||
106 | (.e.g. the "master" branch). | ||
107 | </p></li> | ||
108 | <li class="listitem"><p> | ||
109 | <span class="emphasis"><em><code class="filename">git push</code>:</em></span> | ||
110 | Sends all your committed local changes to the upstream Git | ||
111 | repository that your local repository is tracking | ||
112 | (e.g. a contribution repository). | ||
113 | The maintainer of the project draws from these repositories | ||
114 | to merge changes (commits) into the appropriate branch | ||
115 | of project's upstream repository. | ||
116 | </p></li> | ||
117 | <li class="listitem"><p> | ||
118 | <span class="emphasis"><em><code class="filename">git merge</code>:</em></span> | ||
119 | Combines or adds changes from one | ||
120 | local branch of your repository with another branch. | ||
121 | When you create a local Git repository, the default branch | ||
122 | is named "master". | ||
123 | A typical workflow is to create a temporary branch that is | ||
124 | based off "master" that you would use for isolated work. | ||
125 | You would make your changes in that isolated branch, | ||
126 | stage and commit them locally, switch to the "master" | ||
127 | branch, and then use the <code class="filename">git merge</code> | ||
128 | command to apply the changes from your isolated branch | ||
129 | into the currently checked out branch (e.g. "master"). | ||
130 | After the merge is complete and if you are done with | ||
131 | working in that isolated branch, you can safely delete | ||
132 | the isolated branch. | ||
133 | </p></li> | ||
134 | <li class="listitem"><p> | ||
135 | <span class="emphasis"><em><code class="filename">git cherry-pick</code>:</em></span> | ||
136 | Choose and apply specific commits from one branch | ||
137 | into another branch. | ||
138 | There are times when you might not be able to merge | ||
139 | all the changes in one branch with | ||
140 | another but need to pick out certain ones. | ||
141 | </p></li> | ||
142 | <li class="listitem"> | ||
143 | <p> | ||
144 | <span class="emphasis"><em><code class="filename">gitk</code>:</em></span> | ||
145 | Provides a GUI view of the branches and changes in your | ||
146 | local Git repository. | ||
147 | This command is a good way to graphically see where things | ||
148 | have diverged in your local repository. | ||
149 | </p> | ||
150 | <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"> | ||
151 | <h3 class="title">Note</h3> | ||
152 | You need to install the <code class="filename">gitk</code> | ||
153 | package on your development system to use this | ||
154 | command. | ||
155 | </div> | ||
156 | <p> | ||
157 | </p> | ||
158 | </li> | ||
159 | <li class="listitem"><p> | ||
160 | <span class="emphasis"><em><code class="filename">git log</code>:</em></span> | ||
161 | Reports a history of your commits to the repository. | ||
162 | This report lists all commits regardless of whether you | ||
163 | have pushed them upstream or not. | ||
164 | </p></li> | ||
165 | <li class="listitem"><p> | ||
166 | <span class="emphasis"><em><code class="filename">git diff</code>:</em></span> | ||
167 | Displays line-by-line differences between a local | ||
168 | working file and the same file as understood by Git. | ||
169 | This command is useful to see what you have changed | ||
170 | in any given file. | ||
171 | </p></li> | ||
172 | </ul></div> | ||
173 | <p> | ||
174 | </p> | ||
175 | </div></body> | ||
176 | </html> | ||