You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -276,6 +277,39 @@ Do you see the lines at the top. The first section is labelled `HEAD` those are
276
277
Afterwards git status, add the files in red, commit, and push. Then make a pull request to master like before and merge. Don't forget to update your local master branch, and delete the merged branch in Github and in your local repo. It is good to keep your working environments clean and organised.
Imagine you're working on a project that's getting bigger in size. As new files are added, it makes sense to group some of them into folders. For example, it's a good idea to keep all CSS files in one folder, JS files in another etc.
283
+
284
+
Let's assume you've just cloned a repository structured like this:
285
+
```
286
+
index.html
287
+
stylesheet.css
288
+
script.js
289
+
```
290
+
291
+
However, you'd prefer to split these into folders like:
292
+
```
293
+
css/stylesheet.css
294
+
js/script.js
295
+
index.html
296
+
```
297
+
298
+
In order to achieve this, `git mv` command comes in handy. Using it to move files *ensures preserving history* of the files you work on. To change file structure like above (and create new folders at the same time) use command:
299
+
```
300
+
mkdir css && git mv stylesheet.css ./css
301
+
mkdir css && git mv script.js ./js
302
+
```
303
+
(This glues `mkdir` and `git mv` commands together with `&&` operator).
304
+
305
+
Basic function usage is
306
+
```
307
+
git mv <source> <destination>
308
+
```
309
+
The command also takes optional parameters. To find out more, refer to [documentation](http://git-scm.com/docs/git-mv).
310
+
311
+
312
+
279
313
<a name="github-flow" id="github-flow"></a>
280
314
## Github Flow
281
315
Github flow is what most teams at Founders & Coders follow. It is simple and effective.
0 commit comments