├── README.md
└── index.html
/README.md:
--------------------------------------------------------------------------------
1 | # GitHub
2 | ### Git commands
3 |
4 |
5 | ## Welcome to GitHub Pages
6 |
7 | You can use the [editor on GitHub](https://github.com/SashenJayathilaka/Coding_Website/edit/main/README.md) to maintain and preview the content for your website in Markdown files.
8 |
9 | Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files.
10 |
11 | ### Markdown
12 |
13 | Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for
14 |
15 | ```markdown
16 | Syntax highlighted code block
17 |
18 | # Header 1
19 | ## Header 2
20 | ### Header 3
21 |
22 | - Bulleted
23 | - List
24 |
25 | 1. Numbered
26 | 2. List
27 |
28 | **Bold** and _Italic_ and `Code` text
29 |
30 | [Link](url) and 
31 | ```
32 |
33 | For more details see [Basic writing and formatting syntax](https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax).
34 |
35 | #### Push Repositories
36 | ##### Initialize repository in project folder
37 | ```
38 | git init
39 | ```
40 | ##### Add files to local repository
41 | ```
42 | git add . or git add
43 | ```
44 | ##### (Add comments in Nano or vim) - Commit repository
45 | ```
46 | git commit -m "< message >" or git commit
47 | ```
48 | ##### Show all files which have changes to commit
49 | ```
50 | git status
51 | ```
52 | ##### Add local repository to remote repository
53 | ```
54 | git remote add origin < remote repository URL >
55 | ```
56 | ##### Push local changes to remote
57 | ```
58 | git push origin master
59 | ```
60 | ##### If push was successful?
61 | ```
62 | git push -f origin master
63 | ```
64 | ### How to create a new branch in git
65 | ##### Example for creating a new branch named myNewBranch
66 | ```
67 | git checkout -b myNewBranch
68 | ```
69 | ##### First Push
70 | ```
71 | git push --set-upstream origin myNewBranch
72 | ```
73 | ### Deleting a branch LOCALLY
74 | ##### Deleting a branch locally
75 | ```
76 | git branch -d localBranchName
77 | ```
78 | ##### Delete branch remotely
79 | ```
80 | git push origin --delete remoteBranchName
81 | ```
82 | ##### Refresh branch list
83 | ```
84 | git fetch -p
85 | ```
86 | ##### Force delete if getting merge error
87 | ```
88 | git branch -D local_branch_name
89 | ```
90 |
91 | ##### Removing the last commit
92 | ```
93 | git reset --hard HEAD^
94 | git push origin -f
95 | ```
96 |
97 | ### Git Tags
98 | ##### Checkout the branch where you want to create the tag
99 | git checkout "branch name"
100 | ```
101 | git checkout master
102 | ```
103 | ##### Create tag with some name
104 | git tag "tag name"
105 | ```
106 | git tag v1.0
107 | ```
108 | git tag -a v1.0 -m "ver 1 of .." (to create annotated tags)
109 | ##### Display tags
110 | ```
111 | git tag
112 | ```
113 | ##### Push tags to remote
114 | ```
115 | git push origin v1.0
116 | ```
117 | ```
118 | git push origin --tags
119 | ```
120 | ```
121 | git push --tags
122 | ```
123 | (to push all tags at once)
124 | ##### Delete tags
125 | ###### delete tags from local
126 | ```
127 | git tag -d v1.0
128 | ```
129 | ```
130 | git tag --delete v1.0
131 | ```
132 | ###### delete tags from remote
133 | ```
134 | git push origin -d v1.0
135 | ```
136 | ```
137 | git push origin --delete v1.0
138 | ```
139 | ```
140 | git push origin :v1.0
141 | ```
142 | ###### delete multiple tags at once
143 | local
144 | ```
145 | git tag -d v1.0 v1.1
146 | ```
147 | remote
148 | ```
149 | git push origin -d v1.0 v1.1
150 | ```
151 | ##### Checking out TAGS
152 | We cannot checkout tags in git
153 | We can create a branch from a tag and checkout the branch
154 | git checkout -b "branch name" "tag name"
155 | ```
156 | git checkout -b ReleaseVer1 v1.0
157 | ```
158 | ###### Creating TAGS from past commits
159 | git tag "tag name" "reference of commit"
160 | ```
161 | git tag v1.2 5fcdb03
162 | ```
163 |
164 | ### Math support `$`
165 | ##### To include a math expression inline with your text, delimit the expression with a dollar symbol `$`
166 | ```
167 | This sentence uses `$` delimiters to show math inline: $\sqrt{3x-1}+(1+x)^2$
168 | ```
169 | This sentence uses `$` delimiters to show math inline: $\sqrt{3x-1}+(1+x)^2$
170 | ```
171 | $$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$
172 | ```
173 | $$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$
174 |
175 | ##### find more information https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions
176 |
177 | ### Creating diagrams
178 | You can create diagrams in Markdown using three different syntaxes: mermaid, geoJSON and topoJSON, and ASCII STL
179 | Here is a simple flow chart:
180 | ````
181 | ```mermaid
182 | graph TD;
183 | A-->B;
184 | A-->C;
185 | B-->D;
186 | C-->D;
187 | ````
188 | ```mermaid
189 | graph TD;
190 | A-->B;
191 | A-->C;
192 | B-->D;
193 | C-->D;
194 | ```
195 | ##### find more information https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-diagrams
196 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 | GitHub
11 |
12 |
--------------------------------------------------------------------------------