|
2 | 2 | title: 'Working with remote repositories' |
3 | 3 | description: "Remote repositories are copies of the same repository in different locations" |
4 | 4 | order: 5 |
5 | | -state: 'upcoming' |
| 5 | +state: 'covered' |
6 | 6 | tags: ['git'] |
7 | 7 | links: { |
8 | 8 | 'Working with remotes': 'https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes', |
@@ -81,6 +81,7 @@ By default git will clone into the current directory, |
81 | 81 | creating a directory with the repository's name. |
82 | 82 |
|
83 | 83 | You can provide a different local path: |
| 84 | + |
84 | 85 | ```bash |
85 | 86 | git clone https://path/to/repo /path/to/local/clone |
86 | 87 | ``` |
@@ -162,52 +163,6 @@ git push origin --all |
162 | 163 |
|
163 | 164 | --- |
164 | 165 |
|
165 | | -## Tracking Remote Branches |
166 | | - |
167 | | -```bash |
168 | | -# See all branches (local and remote) |
169 | | -git branch -a |
170 | | - |
171 | | -# Create local branch that tracks remote |
172 | | -git checkout -b feature-branch origin/feature-branch |
173 | | - |
174 | | -# Simplified version (Git 2.23+) |
175 | | -# Auto-tracks if remote exists |
176 | | -git switch feature-branch |
177 | | -``` |
178 | | - |
179 | | ---- |
180 | | - |
181 | | -## Working with Remote Branches |
182 | | - |
183 | | -```bash |
184 | | -# Create local branch |
185 | | -git checkout -b new-feature |
186 | | - |
187 | | -# make changes, commit and push to remote |
188 | | -git push -u origin new-feature |
189 | | - |
190 | | -# Delete remote branch |
191 | | -git push origin --delete old-feature |
192 | | - |
193 | | -# Update remote tracking branches |
194 | | -git fetch --prune |
195 | | -``` |
196 | | - |
197 | | ---- |
198 | | - |
199 | | -## Branch Lifecycle |
200 | | - |
201 | | -1. **Create** branch from up-to-date main |
202 | | -2. **Work** on feature with regular commits |
203 | | -3. **Test** thoroughly before merging |
204 | | -4. **Request** code review |
205 | | -5. **Merge** to main after approval |
206 | | -6. **Delete** feature branch after merge |
207 | | -7. **Update** local main branch |
208 | | - |
209 | | ---- |
210 | | - |
211 | 166 | <class-work> |
212 | 167 |
|
213 | 168 | ### Create your personal github.io page |
|
0 commit comments