Effective PyCharm Transcripts
Chapter: Source control
Lecture: Committing changes

Login or purchase this course to watch this video and the rest of the course contents.
0:00 So we've made these changes to our code and we want to save them.
0:03 We like it we've already tested it.
0:04 We make sure that it runs correctly and we want to put it back into the
0:08 code repository. Show with the team ship it in the next version of whatever this
0:13 app is. Right. So we can go over here and press this button commit
0:17 or the way that I do is I often just use the hotkey I'll just be
0:20 sitting here like time to commit 'cmd+k'.
0:22 if we go to our file here and we click this button show dif you
0:27 get something really interesting remember we saw this def before it said these are the changes
0:32 from how it was before and here's what you did to the file.
0:34 But notice these little checkboxes here.
0:37 These are really cool. We can just if we wanted to just commit this change
0:42 but not this change at the moment.
0:43 Why would you ever do that?
0:45 Well imagine you're working on fixing a bug.
0:49 You're making a bunch of changes and you just want to do the minimal amount of
0:52 work to make that change for that bug.
0:55 Maybe you've done some other stuff here that you want to have a different commit message
0:58 You kind of mixed two things together maybe like well this is changing the title
1:03 and that was one git hub issue and this is refactoring the way that we
1:08 display episode details and that's another one.
1:11 You don't want them both to come here because they got up.
1:13 You can do cool stuff. Like say this is going to this fixes issue 10
1:20 title correction. All right. If we wanted to do that,
1:23 we don't want this to come along with it.
1:26 But we can go and commit that change And then we come back and now here's
1:30 another change. This one is going to be maybe there's another github issue 11
1:34 and that fixes number actually will close it on.
1:36 Git hub by the way. Go over here.
1:39 I want to say refactored display method.
1:44 Right. So we can actually make this multiple changes to one file or across multiple
1:48 files. Get added to the commits and to get repositories and whatnot by selecting just
1:54 different parts. So that's really,
1:56 really cool. That said, I almost never do that.
1:58 Almost just make the files the changes of the files that I need and then just
2:02 commit them and push them all up.
2:04 But depending on the type of team you're working on maybe this is really important in
2:07 which case that level of detail is great.
2:10 Now remember git is a two phase type of operation.
2:16 We've made changes. We saved them to the local Git repository but that doesn't actually
2:22 mean on Git hub or wherever the servers located.
2:25 The changes were made until we push to it.
2:27 So we gotta do this next push.
2:31 Often I just shift command K.
2:32 But however you do it. We pull this up and It'll show us both of
2:36 those changes that we've made. So really,
2:38 really cool there here we can see that this one,
2:42 let's compare the title. Refactored the display method is going to be just this
2:45 change and a different commit. Was this one where we fixed the title.
2:50 We're going to push both of those changes up to git hub right now and there
2:53 there are, we pushed 2 commits up to github and now our code
2:58 is pushed up there and saved in a sync and everyone can pick it up and
3:02 run with this amazing new feature we've created.