Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
In this video, we make some additions to our project and learn about helpful features and best practices when making changes in our repository.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
How about we add a new
file to our project.
0:00
We'll add a class.
0:02
Add>Class.
0:03
Let's call it Person.
0:06
Teams require people, right?
0:09
Now, in Solution Explorer, there's
a little plus sign next to the new file.
0:12
That means it's new to the project and
not yet being tracked.
0:17
You can also see there's a red check
mark next to the project name.
0:20
That means the project has changes
that haven't been committed.
0:23
We can go ahead and
commit this before going any further.
0:27
Right-click on the project,
source control, and commit.
0:29
Say add new class for
the commit message and commit.
0:35
Let's add some properties
to our new Person class.
0:42
We'll give it a name, public string
0:45
Name {get; set; } and an address,
0:50
public string Address {get; set; }.
0:55
Back to team explorer,
click on home, and then changes.
1:01
Add new properties for
the person class and
1:08
then commit.
1:13
Actually, I'm going to split out
name into a first and a last name.
1:17
Let's take a look at that change.
1:28
In Solution Explorer, right click on the
file and choose Compare with Unmodified.
1:31
This is called a dif, in this view we've
got our original file on the left, and
1:37
the modified file on the right.
1:42
This is a nice feature to review
exactly what's changed in the file,
1:44
especially when we encounter
conflicts with someone else's code.
1:48
The lines that are green indicate that
something's been changed or added to
1:51
the modified file, and the red lines
indicate that something's been deleted.
1:54
Everything looks good here.
1:58
We'll commit these changes and
go ahead and sync with the server.
2:00
Team explorer.
2:03
Home.
2:05
Changes.
2:06
Split name into first and
last name and commit.
2:10
To get back to the same pane, in team
explorer click on the home and then sync.
2:16
Here's our commits we've made and sync.
2:21
How about we try to commit a deleted file.
2:26
We'll create a class.
2:29
Let's call it Team.
2:33
And, commit.
2:37
Let's make our commit message
New Team Class, and commit.
2:39
Okay, now let's delete it.
2:47
Delete and source control, commit.
2:50
I'll say I changed my mind
about a team class for now.
2:57
Notice that the file
name is crossed out here.
3:04
And commit.
3:07
Now that we've got a few commits on our
repo, we can take a look at the history.
3:10
In Solution Explorer,
right-click on the project name,
3:14
Source Control, View History.
3:18
Here's a list of all our commits that
have happened within the project.
3:20
If we right-click and
3:23
hit View Commit Details We can see all the
changes that were included in the commit.
3:25
Well, say we want to get the team
file back, we can revert this commit.
3:31
Our revert will undo all changes in
a single commit by adding another commit.
3:36
It's really good to be sure of all
the changes that will be reverted.
3:40
This commit only has a deleted file,
so right click.
3:44
Revert, yes I'm sure I want to revert.
3:49
Now if we look at the history again,
Source Control,
3:53
View History, there's a new commit
that contains the reverted changes.
3:57
And we've got our file back.
4:02
If we want,
we could even revert the revert.
4:03
Let's take a look at just the Team
files history right-click View History.
4:06
Here's our changes that have
happened only on the Team file.
4:11
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up