-
Notifications
You must be signed in to change notification settings - Fork 2
/
gitnotes.html
133 lines (129 loc) · 5.14 KB
/
gitnotes.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content="">
<meta name="author" content="Graham Wakefield">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="stylesheet" href="css/basic.css" type="text/css" />
<link rel="stylesheet" href="css/github.css" type="text/css" />
<style>
img {
max-height: 75vh;
}
td { vertical-align: top;}
header {
background-color:#f5f5f5;
font-size: 75%;
padding: 0.5em;
}
footer {
background-color:#f5f5f5;
font-size: 75%;
padding: 0.5em;
}
</style>
</head>
<body class="centremaxwidth960">
<header><a href="index.html">Foundations of Digital Media</a></header>
<h1 id="git-notes">git notes</h1>
<ul>
<li><p>Go to your github.com/[username] </p>
<ul>
<li>(Make sure you are signed in)</li>
</ul>
</li>
<li><p>Repositories tab</p>
<ul>
<li>Green button "new"<ul>
<li>Name: <code>digm5010</code></li>
<li>Public</li>
<li>Add Readme</li>
<li>Add .gitignore, template <code>Node</code></li>
<li>Choose license appropriately</li>
<li>Create Repository</li>
</ul>
</li>
</ul>
</li>
<li><p>Code Tab</p>
<ul>
<li>Branches drop-down window</li>
<li>Find or create a branch...<ul>
<li>Type <code>gh-pages</code> (enter)</li>
</ul>
</li>
<li>Your website is now published at https://[username].github.io/digm5010</li>
</ul>
</li>
<li><p>See Green <code>Code</code> tab</p>
<ul>
<li>Copy the URL under "Clone with HTTPS" (or "Clone with SSH" if you have <a href="https://docs.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account">set up SSH keys</a>)</li>
</ul>
</li>
<li><p>Open up VS Code</p>
<ul>
<li>Open up the Terminal (Menu View / Terminal or Terminal / Open Terminal)</li>
<li>In the terminal:<ul>
<li>navigate to the folder you want to clone into (using <code>ls</code>, and <code>cd [path]</code>), <ul>
<li>where [path] is a relative or absolute path to a folder (e.g. <code>Documents</code> to cd into the Documents subfolder of your current path, or <code>..</code> to navigate up one folder, etc.)</li>
</ul>
</li>
<li>Clone the repo by <code>git clone [URL]</code> where URL is the path you copied from the Github Code dropdown above.<ul>
<li>This creates a local copy of your repository in the <code>digm5010</code> subfolder of this path</li>
<li><code>cd digm5010</code> to go into this repo</li>
<li><code>git checkout -b gh-pages</code> to change to the <code>gh-pages</code> branch</li>
<li><code>git branch</code> to show what branches we have (asterisk shows which one we are in)</li>
<li><code>git push -u origin gh-pages</code> to tell our local <code>gh-pages</code> branch to push to the remote (Github cloud) <code>gh-pages</code> branch</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>Great, you now have a local copy of the repo. Now you can make changes and pull & push!</p>
<ul>
<li>Open that new repository in VSCode<ul>
<li>E.g. File -> Open Folder -> select the repo</li>
<li>Or, in Windows you might be able to find it in File Explorer and right-click to pick 'Open in Code'</li>
<li>Now open the Terminal again (Menu View / Terminal)</li>
<li>Make changes to a local file, e.g. edit <code>Readme.md</code> or create a new <code>index.html</code></li>
<li><code>git status</code> will tell you what you have changed locally</li>
<li><code>git add [filenames]</code> to <strong>stage</strong> files for committing</li>
<li><code>git commit -m "[notes about why change was made]"</code> to <strong>commit</strong> the change, adding notes to remind my future self what I was thinking of</li>
<li><code>git pull</code> to grab any changes anyone else might have made and resolve any merge conflicts if there are<ul>
<li>if you cloned with HTTPS you will need to put in your Github password at this point</li>
</ul>
</li>
<li><code>git push</code> to upload this to the remote repository.<ul>
<li>if you cloned with HTTPS you will need to put in your Github password at this point</li>
<li>or <code>git push -u origin gh-pages</code> if it complains about not knowing which branch to push to -- should only need to be done once.</li>
</ul>
</li>
<li>Your update should now be live, or will be within a few minutes</li>
</ul>
</li>
</ul>
<p>Micheal Palumbo's recommended links:</p>
<ul>
<li><a href="https://github.com/worldmaking/worldmaking.github.io/wiki/Git-Best-Practices">Git best practices</a> on Alice lab wiki</li>
<li><a href="https://foundation.mozilla.org/en/initiatives/mozilla-open-leaders/">Mozilla Open Leaders</a></li>
<li>Recommended Markdown editors<ul>
<li>MacDown <a href="">https://macdown.uranusjr.com/</a></li>
<li>Haroopad <a href="">http://pad.haroopress.com/</a></li>
</ul>
</li>
<li><a href="https://onlywei.github.io/explain-git-with-d3/">Explaining git using D3</a></li>
</ul>
<p>Git colours in terminal:</p>
<pre><code class="language-sh">git config --global color.ui auto
git config --global color.branch auto
git config --global color.status auto</code></pre>
<footer>DIGM5010 2021-22</footer>
</body>
<script src="js/connect.js"></script>
</html>