Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[doc] Version Control Exercise #2

Merged
merged 5 commits into from
Jul 26, 2022
Merged

[doc] Version Control Exercise #2

merged 5 commits into from
Jul 26, 2022

Conversation

zwgold
Copy link
Contributor

@zwgold zwgold commented Jul 20, 2022

resolves umrover/mrover-ros#41

Adapted the EECS 280 Lab 0 Version Control Exercises into a markdown for new members to work through to gain experience handling changes across different local repositories.

@zwgold zwgold added the documentation Improvements or additions to documentation label Jul 20, 2022
@zwgold zwgold self-assigned this Jul 20, 2022

Everyone run `git status`. We'll run this frequently, and you should make a habit of it - it's a
good way to check the state of your local repository. You should see that you are up-to-date with
`origin/main` (the "origin" refers to the remote repository on gitlab).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

References to GitLab can be deleted

Copy link
Contributor

@tabiosg tabiosg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exercise has useful information. I like it. Just delete references to GitLab.

Copy link
Member

@niwhsa9 niwhsa9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff, nice work. LGTM pending resolving what @tabiosg pointed out

@zwgold
Copy link
Contributor Author

zwgold commented Jul 20, 2022

Do you guys think it'd be a good idea to add some diagrams to how the commits/workflow occurs? I'm fine either way, but what we already have is a lot so I understand if not

@tabiosg
Copy link
Contributor

tabiosg commented Jul 20, 2022

Do you guys think it'd be a good idea to add some diagrams to how the commits/workflow occurs? I'm fine either way, but what we already have is a lot so I understand if not

I personally never found those diagrams useful when I was trying to learn Git (because they are usually too "complicated" for the basics).

The most useful image I've ever came across about was this one since it helped me understand the difference between local and remote:

here

Having diagrams for merging and pull requests is quite messy and complicated, and if you do add a diagram for that, I would keep it to one (I was looking for a good diagram as an example but gave up since all of them would probably just create confusion).

@zwgold
Copy link
Contributor Author

zwgold commented Jul 20, 2022

Honestly, at that point, I think we'd be fine to leave it out. I think for the wiki it may be a good idea for one of us to make some illustration or diagram of how MRover workflow works since this is merely a tutorial/intro. I think leaving it as is without a diagram is fine.

@niwhsa9
Copy link
Member

niwhsa9 commented Jul 20, 2022

I imagine some whiteboarding sessions during meetings will still be in order, even when we front load the teaching effort with great resources like this. I hope everyone has been practicing drawing git trees 😆

@zwgold
Copy link
Contributor Author

zwgold commented Jul 20, 2022

Ok, last set of changes. Mostly grammatical, some smaller things with boldening and me leaving in "lab staff." I also added a note that rebasing should not be an option almost never. Feel free to peek quickly and once @CameronTressler reviews and approves, we can merge

Everyone in the group should sign into their GitHub account they plan to use with the MRover team, if they have not done already.

**Person 1** should create a new repository on GitHub. From here, Person 1 should ensure the following when creating the new project:
* Name it `mrover-vc-exercise`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be good to explain the 'vc' acronym, people may not realize what this is. Within this, could say that svn is an alternative to git

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively I guess I could talk about this in the workflow-intros readme, but I think it would make a little more sense here? That other one is really just about pull requests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll put something in the beginning that talks about VCS and Git vs. SVM; I didn't feel like it would be necessary, but it would be good for members to know

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good


To actually work on the code, you will need to **clone** the remote repository to create a **local repository** on your own computer.
1. Open a terminal and navigate to a folder. We recommend making one called `mrover` to store all the work you will be doing with us.
2. Run the following command (replace `zwgold` with the username of the person who had created the remote repository): `git clone [email protected]:zwgold/mrover-vc-exercise.git` (Note: This command will only work if you have SSH Keys set up. Please follow the steps in the first tutorial to do so!)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be changed to describe how to find the link from the browser page? Personally, I very rarely just type the link directly, usually I copy it from the 'code' drop down

This should create a new folder called `mrover-vc-exercise`. That is your **local repository**.

## Making a basic change
At this point, everyone should have a new directory for the **local repository** called `mrover-vc-exercise`. Navigate your terminals into that folder using `cd`. You can check that you are in the right place with the command `pwd`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a little pedantic but I would recommend explicitly saying 'using cd mrover-vs-exercise'

`origin/main` (the "origin" refers to the remote repository on github).

Run the command `ls`. You should see the default `README.md` file that GitHub created automatically with the project. Feel free to go ahead and open the file in your IDE. (You could also just open the
whole folder in your IDE.)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a newline accidentally got into this line

**Person 2** should continue to lead for this section. Others should follow along.

1. Run `git add README.md`. This **stages** the changes so they can be committed.
2. Run `git status`. That file is now staged and ready to be committed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for clarity, I would say "This shows that the file is now staged..." to be clear that git status doesn't do anything

1. Run `git add README.md`. This **stages** the changes so they can be committed.
2. Run `git status`. That file is now staged and ready to be committed.
3. Run `git commit -m "modify readme"`. This **commits** the changes to your **local repository**. You can think of each commit in the repository as a step along the version history of your code. The `-m` adds a note about what the commit does.
4. Run `git status`. Your **local repository** is a step ahead of the **remote repository**.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above

2. Run `git status`. That file is now staged and ready to be committed.
3. Run `git commit -m "modify readme"`. This **commits** the changes to your **local repository**. You can think of each commit in the repository as a step along the version history of your code. The `-m` adds a note about what the commit does.
4. Run `git status`. Your **local repository** is a step ahead of the **remote repository**.
5. Run `git push`. From here, you may need to configure your upstream, which if needed, a message will pop up with the corresponding command to do so. Additionally, you may need to enter your GitHub username/password.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm tempted to just say we should describe what 'upstream' here means, but that might be pretty challenging for a novice git user to understand, and not completely necessary for now. Alternatively, we could just tell them to run git push origin main

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it, I'm going to change the command, but additionally, explain what upstream means. I'll send what I had in mind and if it's too much we can just use the command git push origin main with a very brief explanation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good


Note that the `-A` flag will stage all files that have been modified.

Now, **Person 1** should make one change to their copy of `README.md`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully they get the point, but just in case, probably good to specify this should happen before pulling

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call

@CameronTressler
Copy link
Contributor

CameronTressler commented Jul 25, 2022

Looks good! I added a few small comments that should be pretty straight-forward to address. Sorry for taking a few days

@CameronTressler CameronTressler self-requested a review July 26, 2022 02:25
@zwgold zwgold merged commit 45d4f09 into main Jul 26, 2022
@zwgold zwgold deleted the git-tutorial branch July 26, 2022 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Git and version control tutorials
4 participants