Skip to content

Commit 93f5d8e

Browse files
committed
Added git 'status' and 'branch' to beginning of guide.
1 parent 0571be6 commit 93f5d8e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

0 General/11 Git Lab Workflow.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,45 @@
55
* Replace the `<new-branch-name>` items below with your appropriate formed `<studentdirectoryname-labnumber-lab-name>` branch name.
66
* An example `<new-branch-name>` would be `bruce-lab01-python-exercise`
77

8+
1. It's good practice to get the current git status to see what branch is current, what files have been changed, and other details:
9+
`git status`
10+
11+
1. Reminder, git branch can be used to see our current branch and other available local branches:
12+
`git branch`
13+
814
1. Checkout the `main` branch since we want to keep it syncronized with remote:
915
`git checkout main`
16+
1017
1. Retrieve the remote changes to `main` branch and sync them to local repository:
1118
`git pull origin main`
19+
1220
1. Create a new branch `<new-branch-name>` from current state of `main` branch:
1321
`git checkout -b <new-branch-name>`
22+
1423
1. Do some code changes.
24+
1525
1. Add all the changes made to git tracking (or add only `<filename>` or `<directoryname>` changes):
1626
`git add -A`
27+
1728
1. Commit the changes made to the branch:
1829
`git commit -m <commit message>`
30+
1931
1. Push local changes to branch `<new-branch-name>` to the remote repository `origin`:
2032
`git push origin <new-branch-name>`
33+
2134
1. Do some more code changes.
35+
2236
1. Add all the changes made to git tracking:
2337
`git add -A`
38+
2439
1. Commit the changes made to the branch:
2540
`git commit -m <commit message>`
41+
2642
1. Push local changes to branch `<new-branch-name>` to the remote repository `origin`:
2743
`git push origin <new-branch-name>`
44+
2845
1. When lab is completed, [create pull request on GitHub](10%20GitHub%20Pull%20Request.md).
46+
2947
1. After lab has been graded and pull request approved, perform the following two commands to remove the reference to the remote branch, and then delete your local branch:
3048
1. `git remote update origin --prune`
3149
1. `git branch -d <graded-and-merged-branch-name>`
@@ -37,20 +55,26 @@
3755
1. Git `add` and `commit` changes to current branch:
3856
1. `git add -A`
3957
1. `git commit -m <commit message>`
58+
4059
1. Checkout the different branch we want to work on:
4160
* `git checkout <a-branch-name>`
61+
4262
1. Do the code changes for this branch.
63+
4364
1. Git `add` and `commit` changes to the new current branch `<a-branch-name>`:
4465
1. `git add -A`
4566
1. `git commit -m <commit message>`
67+
4668
1. Checkout some other branch we want to work on:
4769
* `git checkout <some-other-branch-name>`
70+
4871
1. Repeat process as needed.
4972

5073
## Use the following to delete branches for labs which have already been graded.
5174
* NOTE: We delete the branches after they have been merged into `main` since the work has been completed and all the changes have been recorded in the `commit`s. We no longer need the branches.
5275

5376
1. Sync our local record of remote branches. This will remove local references to branches which have been deleted on remote:
5477
* `git remote update origin --prune`
78+
5579
1. Delete the local copy of the branch:
5680
* `git branch -d <lab-branch-which-has-been-graded>`

0 commit comments

Comments
 (0)