An Example Git Development Workflow
This lesson is a summary of everything you have learned in this course. You’ll see an example development workflow that makes use of all the git commands you learned up to this point. To continue your learning journey, check out the Real Python Podcast Episode 179: Improving Your Git Developer Experience in Python with Adam Johnson.
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.
00:00 Okay, my friend. We’ve reached the end. Let’s take a look at an example development workflow. Now we’ve reviewed many of the basic Git commands in this course, so let’s quickly step through a typical sort of workflow.
00:15 And this is assuming that you are using a local and a remote repository. This is something you might do every time you sit down to work on a project. There are, of course, better ways to set up your workflow and you’ll probably find a way that works great for you as you advance, but this’ll be a good starter and a recap for what we’ve learned so far.
00:37
So when you first sit down, you’ll probably run git status
and check your current working area and you’ll git pull
to get the latest version from the remote. Make all your changes and updates.
00:50
Run git status
to see all the files that have changed and kind of review your session, what you did during your session. git add
and bring those files into the staging area. And you’ll make your commit—don’t forget your imperative message! And finally, you’ll push your changes up to the remote. Speaking of pushes, I’m going to push up out of here.
01:11 Thank you so much for joining me on this course. I hope you learned a lot. Any questions or comments, please throw them in the comment boxes and we’ll get you an answer as soon as we can!
Paul Mealus on June 5, 2019
I very much appreciate the feedback @charliem22. For those looking for the next steps, pro git is a fantastic resource as Charlie mentioned. If you’re looking for some scenario based learning I’d suggest Learn Git Branching which will run you through some advanced scenarios including rebases and making sense of branch spaghetti.
Github also has some free labs, but I’ve never used them, would be interested to hear if anybody has.
Jet on June 12, 2019
The GitHub learning labs are very useful. If you are learning coding by yourself and trying to work with GitHub, it is difficult because you have no ‘team’ working with you on a project. The labs work with bots and you will go through examples of how it would be to work with someone in the same repo, pushing changes, making merge requests etc. The downside is that if you do something that is not anticipated by the lab, you get stuck somewhere and cannot finish it. I had to delete the repo I created for one of the learning labs in order to start from scratch and go through the entire lab. Still, I guess no matter how many tutorials or labs you go through, you will only really get a grip on it by working with it on a daily basis. You will however pick up useful information. The RealPython tutorials and videos are very good and cover quite a bit of detail. Thanks for that!
ulhasbhagwat on June 12, 2019
one more video on how to get back deleted file(s) as well as re-setting the master back to earlier version would help!
Abby Jones on June 24, 2019
Excellent refresher. Been out of the game, so this was very informative and concise.
LJIN Lab on Aug. 25, 2019
Great tutorial as always, but would have liked to see how to migrate from a local repo to a remote github repo.
mdroberts on Nov. 18, 2019
Very good and succinct tutorial!
Erikton Konomi on Jan. 6, 2020
Nice and concise overview of git!
Lokman on Jan. 13, 2020
Thanks for the easy and short tutorial. Love it!
Damian on Feb. 24, 2020
This tutorial is a gem. While simple, it really demystifies the basic of github. thanks a lot. What do you recommend as a follow up course to continue building on this basics?
Thanks again!
Ricky White RP Team on Feb. 24, 2020
Hi @Damian. If you are new to git, then I recommend practice more than anything, before digging deeper. If you’re not new, then you could dig into the official docs and find a few gems in there that might help your workflow. git-scm.com/doc
pshapard on April 8, 2020
Just completed the video. This course plugged some holes in my git/github knowledge. Still a lot to learn. Software development does not seem so scary. Thanks for your help Paul. Onto the next video
fjavanderspek on April 17, 2020
Clear and concise, awesome!
Patrick Prince on May 22, 2020
Hey Paul, very well done. Thanks for your effort on this. Maybe as a revision add a lesson the github client? Cheers!
Mark on June 5, 2020
Thanks So Much Paul
Kasidis Satangmongkol on June 15, 2020
Many thanks Paul !!
theeternalstudent on June 24, 2020
Thanks for stepping through this! I was able to work with a remote BitBucket repository a teammate had setup. Before this video I simply copied the files. Now I know how to interact properly at the most basic level with a remote repository.
Alan ODannel on July 16, 2020
Very nice refresher course. I’ll be pulling down the Pro Git soon. The checkout and branches cleared a few things up for me.
mahlenius on July 21, 2020
Excellent tutorial Paul, thank you for your work on this. For some reason, I keep getting errors when I tried to do a “git clone https://…” to my private repo. It would respond with a fatal error. When I recreated the repo as a public one, it worked. I was using the same creds each time. Will have to go back and revisit this one as for some of my work projects I cannot make them public. Thanks again!
John Kinder on Sept. 1, 2020
Thanks for this wonderful tutorial. Each topic was short but concise, and I was able to pull all the real python material down to my VM… much appreciated!
jamesbrown68 on Sept. 24, 2020
You’ve got a friendly relaxed style, which was refreshing. Thanks for the info. I still don’t see how multiple developers can work on the same project without unknowingly stepping on each other’s work, but I’ll download the ProGit book and see if I can learn by doing.
anindo78 on Nov. 2, 2020
Thanks Paul! Very good beginner level introduction to Git and Github!
horacionesman on Dec. 29, 2020
Very helpful, it was the explanantion I needed to fully understand this topic. Thanks!
jeffersongarciaor on Feb. 10, 2021
Thanks Paul! I learned a lot, and finally I can understand the git workflow. Very helpful and you were very instructive.
Antonio Soares on June 30, 2021
Git has intimidated me for quite some time but I’ve always wanted to learn how to use it. Although there are quite a lot of things you could have added to the course I think it’s wise that you kept it to these bare essentials. I felt it gave me enough of a base to stand on and learn as I go.
Glenn Lehman on July 8, 2021
Excellent Work!
I really need the foundation I have tried for a few months to grasp the core concepts need to work with git.
Remaining Questions- You used gitBash since I live in the windows world I have used git to this point. Are there benifits to using the gitBash instead?
- When I pulled the zen_remote report the .gitignore file did not come over. Is that normal behavior? Do I need a local .gitignore if I have on in the remote repo?
Martin Breuss RP Team on July 9, 2021
Hi @Glenn Lehmann, glad you found the course helpful. :) About your remaining questions:
Git Bash
I’m not entirely sure I understood your question. If you’re on Windows, like Paul is, then you’ve probably already used Git Bash, unless you’ve been working with a GUI tool for Git.
Here’s a description of Git Bash:
Git Bash is an application for Microsoft Windows environments which provides an emulation layer for a Git command line experience. Bash is an acronym for Bourne Again Shell. A shell is a terminal application used to interface with an operating system through written commands. Bash is a popular default shell on Linux and macOS. Git Bash is a package that installs Bash, some common bash utilities, and Git on a Windows operating system.
So, if you’re on Windows and you’ve followed along with this course and typed Git commands in your shell, then you’re already using Git Bash. It comes with the installation for Windows, or you can get it together with a GUI client in a Git for Windows package.
The .gitignore
File
You can commit a .gitignore
file to version control and to your remote repository. Generally, this is recommended, so that collaborators know which files you excluded. However, you can also add the .gitignore
file to your .gitignore
file, which effectively prevents it from being recorded in your VCS.
I’m not sure where you pulled the zen_report
from, but if you didn’t get a .gitignore
file, then it’s because it wasn’t commited to that repository.
You can have a local .gitignore
file, or you can get it as part of a remote repo, when you pull it to your computer. It just depends on whether or not the file was committed to the repository.
Hope that helps clearing up things.
Glenn Lehman on July 10, 2021
Thanks @Martin Breuss
GitBash
I did a little more research and found a few minor differences. From the Windows PowerShell if I run the Git command everything works fine as far as Git is concerned.
Since I have never used Unix I have not used the Bash editor. As GitBash appears to not only include the git command line, but also a bash emulator for windows. So you can edit files and a few other bash type items.
In my case since I do not us the VM editor, I can do everything I need with Git.
.gitignore
I actually create a new repo on GitHub and allow the .gitignore file to be create automatically. When I cloned the repo to my local drive the .gitignore file was not brought over to my local directory.
Glenn
Martin Breuss RP Team on July 12, 2021
Hi @Glenn Lehman – gotcha about Git Bash :) Looks like you won’t need it then.
.gitignore
I’ve tried the steps that you described and initialized a new empty repository on GitHub with the suggested .gitignore
file by checking the ✅ Add .gitignore option.
Then I pulled the repo to my local machine and looked at the content of the folder. The auto-generated .gitignore
file showed up:
➜ Desktop git clone https://github.com/martin-martin/ignoremetest.git
Cloning into 'ignoremetest'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
Receiving objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
➜ Desktop cd ignoremetest
➜ ignoremetest git:(main) ls -al
total 8
drwxr-xr-x 4 martin staff 128 Jul 12 09:33 .
drwx------+ 32 martin staff 1024 Jul 12 09:33 ..
drwxr-xr-x 12 martin staff 384 Jul 12 09:33 .git
-rw-r--r-- 1 martin staff 1799 Jul 12 09:33 .gitignore
It’s a hidden file, so maybe you need to adapt your folder settings to display hidden files?
Philip GeLinas on Sept. 25, 2021
Well done! Thank you!
andrewodrain on March 22, 2023
Excellent! I can use GitHub the way its supposed to be used now! Thank You!
Duane aK on May 2, 2023
Great, I understand Git/GitHub now! Thanks for your hard work.
Jon Nyquist on June 22, 2023
Nice course. Seems GitHub has changed a few things since this course was published, especially around authentification, but most most of the lessons remain valid.
Danadasa Chan on July 26, 2023
Thank you for this clear tutorial! I now have a handle on git basics, and now it’s time to practice.
Become a Member to join the conversation.
charliem22 on June 5, 2019
Excellent introduction. Would have liked a rebasing example but I understand why the complexities of that would make that a bit difficult. Also, pointer to Pro-Git is appreciated. Have started reading it and it’s definitely the ‘next step’ after this video intro. Thanks for your time and effort… charlie