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