Up and Running with Git Transcripts
Chapter: Teamwork: Open source and Pull Requests
Lecture: GitFlow branching style

Login or purchase this course to watch this video and the rest of the course contents.
0:01 We spent a long time talking about feature branches creating a branch, doing a bunch of work. Even the pain off the branch debt before we were
0:11 finished and then merging those changes back into the main branch. Well, working with open source is like this but it's spread out a little bit
0:19 more as we'll see. So typically with an open source workflow we've got the open
0:26 source project. It has it to get repository and there's an additional step instead of
0:30 working directly here because remember you might have just found this project,
0:35 you're not a contributor. You don't have permissions to write to this repository or make any changes. So even if you wanted to,
0:42 you couldn't work there instead. We're gonna fork this repository again. This is not a git thing but it's built on top of it over on git
0:52 hub and other hosting services. You can say that repository over there is interesting.
0:56 I also have an account just make a copy effectively clone it but then set my
1:01 copy of it as the hosted destination and then we go down our feature branch path Like I want to consider adding a feature to this open source project.
1:10 So I'm gonna on my repository create a feature branch. Do all the work just like we described before when I'm ready to I propose that
1:19 ready to commit that back. Instead of syncing back to the main branch on my repository which will get me out
1:26 of sync with the related or linked open source project. What I'm going to do is create a pull request back to the original repository.
1:37 The people who run that will get a notification. They'll see all the changes I've made just like before. We'll see the two yellow changes.
1:45 The red change, the green change. I'll add some comments and conversation and say, hey, this feature is amazing.
1:52 It looks like you're missing this function or whatever it is and here's how I built it up and I would love for you to accept it as the owner of the
1:59 original project. All they have to do is say that looks great. Boom, we'll take it and now it's automatically part of the original repository,
2:07 the original open source software. They don't have to give you any further permissions or access to it. And you're good to go,
2:16 you're now a contributor to that project, Not a full contributor because you don't control the repository but pretty darn close.
2:24 The final thing to do remember, in the feature branch we merged our feature branch into our main just in order to
2:32 remain in sync with the original project. We need to sync with them again, we'll see how to do that in the next chapter as well.
2:41 And now we've merged effectively the changes back into our own project. Now that's not done because we did a direct merge.
2:49 Although technically you could do that, it's done because the original hosted repository changed and we have a mechanism to sync these
2:57 two different remote hosted repositories. Alright, this is what we're gonna do again, even if you're just doing teamwork on your own.
3:06 This is an interesting way to work. It could be that you create the pull requests, but just back to your own repository,
3:11 you saw the github was suggesting that. But this is the git flow way that people contribute to open source. It's going to be a lot of fun.


Talk Python's Mastodon Michael Kennedy's Mastodon