Skip to playerSkip to main content
  • 8 months ago
Welcome to our in-depth guide on *Git Fundamentals*! Whether you're a beginner or looking to strengthen your understanding of version control, this video will walk you through the core concepts of Git, including the *working directory, staging area, local repository, and remote repository.
https://1stepgrow.com/advanced-data-science-and-ai-course/
Transcript
00:00Inside Python, I will create a new folder, project. So I'm in this folder, Project Python.
00:15So I will go to my git bash. And in git bash, go to the directory. Okay. So I will go to
00:24this directory. And this directory is Python, Project Python. And Python is inside work.
00:32So I have to go to work. Inside work, I have Python. And I have Project Python. P-R-O-J-E
00:40C-T Python. C-T is not found. So I have to go to this one case C-D. Okay. So now I'm
00:49over here. It creates a master for me because, okay, let's do this over here. Okay. Let's
00:55go to this and create Python. So I will say Python project. And here I will do C-D slash,
01:04C-D C colon, C-D work. And inside work, I will move to Python project. Okay. So now
01:14I am inside this folder called Python P-R-O-J-E. So how do I start my git? I will create a git
01:21using the git init command. When I do the git init command, it will create an empty
01:26repo inside Python project. If I go to Python project now, I should be able to see my git.
01:32Okay. So now over here, what I will do, I will create a very, very simple file. Okay. We have
01:39already seen all this. So let me put it hello.txt. Okay. It's a hello file and I'm going to write a
01:45line. I am here. Okay. So now what has happened, I have made some changes in the working directory.
01:50Git is sensitive to pick that up. So if I say git status, you can see that there's one code
01:55change made. I can move the code to my staging area. And from staging, I can commit using the
02:02commit code. I can commit this using a commit statement. So I can commit, I can say,
02:09first check, first commit, hello.txt. So this is what we did yesterday. Now what is happening,
02:15my commit has been made. Now this is part one. The other thing that we learned was how to work
02:20in branches. So for example, right now I have only one branch, which is a master branch, but I can
02:25create a separate branch. I can say branch purun, or I can say branch second. So now what has
02:32happened, I have got, now if I check for branches, I will have two branches. So we have two branches,
02:36master and second. So if I want to move to the second branch, I will say git checkout second,
02:44and I move to the second branch. That you can see by this, right? Now in the second branch,
02:49if I make some code changes. So for the second branch, if I make a code changes,
02:54and this code change it will be,
02:58okay. Namaskar. So I will say namaskar. Okay. So now this is my second code change. Now this
03:05code change is only, this is the working directory for only the second branch. So again, the same
03:10drill, git add dot, and then I will say git commit minus M. What is the file? Namaskar.
03:19N-A-M-S-K-A-R-A namaskar. Okay. Git commit minus M. Okay. Sorry. Sorry. Sorry. I did
03:28this, git add dot, and this namaskar. So I have changed my file. Now if I go to the main branch,
03:37if I go to the master branch, namaskar will not be visible anymore. Similarly, when I come back to my
03:44second branch, namaskar is visible, right? At some point of time, I have to merge both the
03:52branches, right? So how do I merge the branches? I go from the second branch, the master branch,
03:59git checkout master, and from the master, I can merge the second branch.
04:08Now when I merge the second branch, now the master and the second branch are in sync.
04:14The diagram had three parts. The first part was our local working directory, the staging area.
04:21This is the working directory, the staging area, and the remote, okay? This is my local repo.
04:29This is one more repo, and this is my remote repo. Yeah, this is my remote repo.
04:36So now what has happened? Let me just put a couple of arrow marks. I first moved the file
04:43in this direction. Then I moved the file. I don't know how to show this. Okay, probably.
04:51From the staging to the remote, and now from the local to the remote repos.
05:00Okay, now you have to sign up. Just click on the sign up button.
05:04Okay, you have to enter your email ID. Continue. You have to create a password.
05:10Continue. There are two ways in which we can create our remote repository.
05:17So first way is, option one is that we already have a local repository, right? Python proj is
05:25our local repository, right? So from this local repository, we will create our remote repository.
05:32That is option number one. Option number two. Option number two is that first we create the
05:37remote repository, and then we come and create our local repository. But because in this particular
05:43example, we have already created our local repository, hence we will use this local
05:49repository to create our remote repository. So first I will show you option one, and then I will
05:55show you option number two. So to create a repository, you have to click on the new button.
06:01Okay, I will show one more time. There is a new button over here. Click on the new button to create
06:07a repository. Now on this repository, you can give this repository a name. For example, I can say
06:14python underscore proj. This is the name of my repository. Okay, now python proj is the name of
06:21the repository. This is going to be my local remote repository. You can give a description to the
06:28python code for web scrapping. Okay, you have to make it a public repository because to make
06:38it a private repository, you have to pay GitHub money. We are all using GitHub free accounts,
06:43right? The company will use a private account, obviously. But for us, it's always free accounts.
06:48You don't want to create a readme file, or you may want to create, but I am leaving it blank.
06:52Okay, gitignore file, I will teach you after this how to create gitignore file and what is
06:57the meaning of gitignore file. And then I can say choose a license. There is no license right now,
07:02and I can create a repository. When I create a repository, a repository is created over here.
07:10Now how do we set up our, how do we connect our local repository to our remote repository?
07:17There is a piece of code that is mentioned over here. Okay, this piece of code is mentioned over
07:22here. Just copy this piece of code. Okay, this piece of code is mentioned over here,
07:28and you have to copy this piece of code. Clear everybody? Now, I have to go to my particular
07:35git bash, and I will basically paste this piece of code. Okay, after pasting this piece of code,
07:42I would press the enter button. Okay, so now what has happened is, I have git remote add origin,
07:51and this link. So this link has been given an alias name, and that alias name is called as
07:59origin. When I have to push my code from the local to the remote, and the remote repository
08:08now has been given an alias name, and that alias name is origin. Just like when we say
08:15import pandas as pd, that pd is an alias for pandas. Something like import matplotlib.pyplot
08:29as plt. What is plt? That plt is an alias for matplotlib.pyplot, right? Similarly,
08:38over here, the remote repository, which is denoted by this URL, has been given an alias called
08:45origin. Now, what am I going to do? I am going to say git push, push in the origin. What am I
08:51going to push? I am going to push the master branch in the origin. Let's go to, before doing
08:57this, let's go to the repo. Quickly, let's go to the repo, guys. This is my repo. My repo is
09:04completely empty right now. It's an empty repo, right? And then what happens is, I will say enter,
09:11and if I refresh my repo now, you will see the hello.txt and the namaskara.txt file has been
09:21put up in my repo. Clear? Now, this repo is part of your git profile. Now, your git profile will
09:31have many repos. A repo should ideally be a code or a project that you are writing. For example,
09:38your web scrapping will become a repo, right? Your code where you read data from a JSON and
09:44make it into a list of objects, that can be a repo. Your data analysis project that you did
09:49can be a repo, right? So, these are all going to be repos, and this is going to be your git profile.
09:57So, in your resume, you can mention your git profile. The person who would be interested,
10:04they can come down to your repo on the projects that you have worked on, or let's say they ask
10:11you a certain question in an interview. Have you come across this scenario? And let's say a scenario
10:18is such that you have already coded it and the code is available in your repo. So, you can actually
10:23open GitHub, show the repo, and show the code that we have written to handle that particular piece
10:29of information. So, now what is happening? The person can see your work, can see the code that
10:35you have written. Okay, clear? Now, let's look at the other way. The other way would be to first
10:41create a remote repository and create a blank remote repository and then go the other way around.
10:50So, now we will go the other way. What is the other way? First, we create our remote repo,
10:57then we create our local repo, and then we move the file from the staging to the local repo.
11:04Okay, so it's the other way around. So, for the other way around, first thing that we have to do
11:09is we have to create a repository. So, I will create a repository. This is called new and I will
11:16give a name of a repository. So, let's call this as SQL Python repo. Okay, I am calling it a SQL
11:25Python repo. This is the name of my repository. Okay, SQL Python repo. And now I create my repo.
11:33So, when I create my repo, what will happen is an empty blank repo will be created.
11:39Now, once I create my repo, guys, there will be this particular folder, a particular URL that
11:46will be available over here. This particular URL will be available, right? So, I will have to copy
11:53this URL. Now, let's go one folder up. We can, right now we are in the Python proj folder,
12:00right? Python proj folder. To go one folder up, we will say python cd dot dot. To go to the parent
12:07folder, what is the name of the parent folder? Work. So, if I say cd dot dot, I will go to the
12:12parent folder. Now, I am in work folder. The moment I enter the work folder, you can see that
12:18the branch disappears. Why? Because work does not have any git. So, the branch disappears at work.
12:26Now, what are the steps? First, remote has been created. A remote repo has been created.
12:35And from the remote repo, now I am going to, from the remote repo, I am going to create my
12:44local repo. So, I am going the other way around. So, how will I do that? How will I create my remote
12:50local repo? There is a command called git clone. And I will paste the link that I have copied from
12:56the GitHub page. Sorry. This was the link that I copied. I will copy this link. I will bring it
13:06down here and I will say git clone paste. So, now what have I done? I am cloning this repo into my
13:14local. So, the moment I clone the repo to my local and I go to my local file system, there will be a
13:23project created called SQL Python repo. SQL Python repo is a project that is already created for me.
13:34I enter SQL Python repo and a git already exists for me. And from here, you know how to take it
13:40forward. So, what will you do first? You will cd into the project SQL Python repo. The moment you
13:50cd, you will see that you are in the main. This branch is not called masters. This branch is called
13:56the main branch. No problem. We can work with the main branch also. So, now what we do? We will
14:03go to SQL, copy a bunch of SQL files, go to SQL Python branch, SQL Python repo,
14:12paste the SQL files. We will go to Python and where are my Python files? This one,
14:19this one, this one, this one, this one, this one, this one. These are my Python files. Am I right?
14:33So, I will copy, go back and paste the Python files over here. So, what do I have? I have a
14:38bunch of SQL files. I have a bunch of Python files. So, now this is my working directory,
14:45which is now active. So, if I say git status, the status is that of a working directory,
14:51which shows all the files that have been added to the working directory,
14:55but are not part of the staging yet. So, now what I do? I will say git add dot, check the status.
15:04I get a status called staging, right? And then what do I say? I get git commit minus m,
15:12first commit all py and SQL files. So, I have created my first commit. Clear? I have created
15:28my first commit. At this point of time, my local, my staging and my working staging and repo are all
15:42in sync. Now, what I will do? I will push the code from the repo to the remote. You already know the
15:48how to do it. So, how will I do it? I will say git push origin. What is the name of the branch?
15:57Main. You can check the branch you are in, right? How can you check the branch? Git branch.
16:03You are in the main branch, right? So, you will say git push origin main.
16:11When you are first creating a repo in the remote, that means when you are first creating a repo in
16:18the GitHub page and you are cloning the repo to your local, right? You do not have to give
16:26an alias for origin, which we had to do earlier. If you remember the earlier technique,
16:34we basically copied this code where we gave origin. Basically, this repo was given an alias
16:42for origin. When you are doing it the other way around, origin is already set by the computer.
16:48Origin has already been set by git. You as the user, you do not have to worry about
16:54what is the value of origin. Origin value has been set up by the git, clear? So, now it is git
17:01push origin main, right? What branch? Main branch, say origin. You will push, enter.
17:11Might take a bit of time because there are a lot of files. Now, if you come to your repo
17:16and if you refresh your repo, you will see that in your repo you have all these files.
17:23Clear? You have all these files. Now, let's go back to my code and let's add a bunch of new
17:32files over here, okay? So, I'll add a folder. That folder will be called as html, okay? That
17:42folder will be called html and I will put a bunch of html files over here, okay? I'll put a bunch
17:49of html files over here, okay? I'll put a bunch of html files. So, now where I am? I am in the
17:58which branch? I am in the main branch. Now, when you're working in a company,
18:02what would you do it? You would create your own branch. So, let's say I am the guy who is
18:09responsible for developing the html. So, I'll create a branch called html dev. Then I will
18:15check into the html dev branch. Then what I will say? I will say git status.
18:26Okay, then I will say git add dot
18:31git commit minus m html files committed.
18:37Then I will merge the two branches, right? I can merge the two branches. How can I merge
18:47the two branches? I can say git checkout main branch and here I can say git merge.
18:59See, it is telling that this particular main branch is up to date with the origin main branch.
19:05What is origin? Origin is your remote, right? You are at the origin, right? So,
19:12now what you will do? You will merge the html underscore dev branch.
19:19And now if you say git branch,
19:24it's the main branch. It's the main branch. You can check out to the html branch
19:29and you can check out back to the main branch.
19:34What is the message that you see over here? Your branch is ahead of the origin by one commit.
19:41That means your local branch has one commit which is not present in the origin main branch. How can
19:48I know this? I can check out all the commits, right? So, I can say log minus minus one line
19:55log minus minus one line and I can see all the commits. How many commits are there over here,
20:00guys? There are two commits. If I go to my remote which is the origin, there is a button over here
20:06called commit. See, when I click on the button, I should be able to see all my commits and all the
20:13shorthand of the commit id. Over here, you see all your commits. So, how many commits are over
20:19here? There are one commit. How many commit is over here? There are two commits. What is the
20:24message being said over here? Your branch, that means your local repository is commit ahead of
20:33the origin main. Origin is the remote. So, we are all over here. We have all reached over here.
20:39Now, it is complaining that my branch is ahead by one status, one, right? One commit. So,
20:46what I can say? What should I write, guys? Git push origin main. What am I doing? I am
20:53putting my main branch, pushing the main branch into my origin branch. The origin branch is the
20:59remote branch. So, now if I do git push origin main, okay, and now if I go to the remote repository,
21:12if I go to the remote repository, there will be a folder called HTML.
21:18And inside HTML, there will be these three HTML files created. So, let's say there is one more
21:23guy who is responsible for a bunch of IPython notebooks or a bunch of a different set of Python
21:31files, okay? So, I will first create, that person will come, create a branch for himself.
21:37So, that branch is called web scrap branch. Then he will check into his branch web scrap.
21:46So, he has now checked into web scrap branch. He will come to the working directory and he or she
21:52will create a project that is required for his work. So, he will say web scrapping files.
22:01Files. And then what will happen? He will come to Python and copy a bunch of web scrapping code,
22:09okay? Let's say he copies this web scrapping, okay? Now he comes over here, he puts the code
22:18over here, right? So, this is the work that he has done. He or she has done, it is evening seven
22:23o'clock, time to go back home. So, then what he will say? He will say git add dot git commit
22:32minus M web scrapping files checked in. So, now what he has done? He has committed, right? So,
22:45if I am in the web scrap, I should be able to see the web scrapping files.
22:50See, I am able to see that folder called web scrapping dot underscore files. The moment I
22:56check out to the main branch, I am not able to see the web scrapping. At this point of time,
23:03the two branches are different. Hence, main and origin are up to date. But what will I say? I
23:10will say git merge. What will I merge? I will merge the web scrap. I have merged the web scrap.
23:18Now, if I do git status, my branch git merge web, oh, spelling of merge was incorrect. Sorry,
23:27my bad. So, I merged the web scrap. Now, if I do git status, you will see that my branch was ahead
23:36of the origin branch by one commit. So, my branch is ahead of the origin branch by one commit.
23:43So, if I go to my origin branch, origin main, see in origin also, I have a main. If I go to
23:51my origin main, there is no folder called web scrap. So, how will I push my code? I will say
23:58git push origin main. And when this code runs over here, you should be able to see
24:10a folder for web scrapping. And this folder will have a web scrapping underscore tutorial.py.
24:19Yeah, this is how everybody in the project will contribute to the project. He could be your team
24:26member or he could be from the admin. Now, he will check, he will do the merge. Sometimes there
24:31will be conflicts. So, he will reach out to you guys to resolve the conflict. If the conflict is
24:36in your branch, that admin, he or she will reach out to you to resolve the conflict.
24:42But this work will be done by, but everybody will do this work, checking out to their respective
24:48branches, checking out to their respective branches. Now, the person checks out to the
24:54branches, person goes over here and makes a small code change. So, that small code change would be
25:02also imports the math library and also imports datetime library. The code imports the datetime
25:12library, math library, and I also import the random library. And do you do a random stuff.
25:21So, you can say random underscore numbers is equal to, you want 10 random number, random dot
25:29randint, random dot randint for x in range 10. Okay, random dot randint for x in range 10.
25:42So, this is an extra piece of code that you have written and then you would print out the
25:46random numbers. So, you will say square random numbers is equal to num to the power 2 for
25:59num in random numbers. Something, some basic stuff. Okay. You have saved this code. Now,
26:07you are in the web scrap branch. You are in the web scrap branch. Okay. So, what I will say,
26:13I will say git add dot. Okay. So, first check the git status. File has been modified. Git add
26:25the name of the file or you can say dot. I will say dot. Git commit minus m changes
26:36random module in web scrapping s-c-r-a-p-p-i-n-g tutorial dot py.
26:44Commit has been done. Right. So, now you are, well, you are in this particular branch.
26:55This is your working directory. Hence, you are able to see this code. Right. Now,
27:02once you check out, check out to the main branch, git checkout main.
27:09Your branch is the main branch and it tells that your main branch is up to date with the remote
27:14main branch. Your github.com main branch. Now, if you come to over here, you will see a message.
27:21See what it says. Your file has been modified by another program. Do you want to reload it?
27:26Yes. And here, this is the working area of the main. Hence, you don't see the changes that you
27:34have done right now. How can you see the changes? You can git merge the web scrap branch.
27:47So, now once you git merge the web scrap branch, again, you reload the page and you can see the
27:51changes come up over here. Now, if you check the git status, your main branch is one commit before
27:58the origin main commit. So, what you will do? You will say git push the changes to the origin
28:05from the main. Perfect. Now, you go to your this. No files have been added, but a particular file
28:14has been modified one minute ago. So, what will happen? I will go to this particular and I will
28:22open this file. It will open in the browser itself. And when the file opens in the browser,
28:27you can see those additional two lines of code and the import statement that I have written.
28:31Now, if you check in your code, what will happen is once you every day you check in your code,
28:36you will see that these particular boxes, these boxes are every day. So, this particular box
28:44will become green in color. That means I checked in 14 contributions. That means I did 14 push
28:52from my local to my remote, 14 times I pushed. So, these are also gradients, did not push,
28:59little push, more push. So, I made 14 push on today. I made 14 push statements on today.
29:08So, a good developer should have this particular tree lit up green. So, there is a scenario
29:16where I go to my main place and I copy a bunch of files which I do not want to
29:23share with the world. So, for example, there is this file
29:31which I have, which are called targets. And I don't want to share my targets with the world.
29:37So, the targets are for me to see. So, what are my targets? My targets are complete,
29:44all problem statements in web scrapping, code, mat, plot, lib, graphs, using a JSON file as a
30:04config. Okay. So, these are my targets. Now, these targets are internal to me and I don't
30:12want these targets to be part of my output. Okay. If I go to my git status,
30:18what will happen now? It will show me that target is a file that needs to be checked in.
30:24But I do not want to check in target. Okay. I do not want to check in this file called target.
30:31What do I do? I will create a file called dot git ignore. Touch command will create a file.
30:40Where will it create a file? It will create a file in this particular location,
30:46sql python repo. Now, if I press enter, you would see that I have a git ignore over here.
30:57I have a git ignore. Now, dot git ignore is a special kind of file. What is the purpose?
31:04I can go to dot git ignore. I can open dot git ignore using notepad.
31:09And in dot git ignore, I can mention the file that I don't want to check in.
31:15I can say targets dot ht, sorry, targets dot txt. This is the file that I don't want to check in.
31:25Targets, t-a-r-g-e-t-s dot txt. I will say control s and I will close.
31:35Now, if I come back to my this and if I say git status, it will only show me that git ignore
31:43needs to be checked. It does not show me that target dot txt needs to be checked. Why? Because
31:49inside git ignore, I have mentioned which files have to be ignored and the file that has to be
31:57ignored is the targets dot txt. So, let me be in the main only. Git add dot git commit minus m.
32:10I will say git ignore file. Okay. So, there's a commit. So, if I say git log
32:17minus minus one line, you will see the latest commits.
32:22If I say git status, you would see that the local main is one check in ahead of the
32:32remote main is ahead by one commit. So, what will I say? I will say git push
32:38origin main. Enter. And when this push happens, that in my repository, in my SQL Python repo,
32:55I will have the git ignore file, but I will not have the target file.
33:01And if you open the git ignore file, you will see that the git ignore has this targets dot txt,
33:06but this target dot txt. So, if you try to go to targets,
33:12you will see no match found. If you try to go to class 14,
33:19you will have a match, but for targets, you will not have a match.
33:23So, this is the purpose of the git ignore file. Whenever you want to ignore a file,
33:28you can list it in the target. Sometimes a git ignore will not work properly. Why? Because this
33:37software, git will keep a cache. You know what a cache is? A cache is a reserve piece of memory
33:44where we basically hold values that we have used. So, the git ignore will keep some data that it
33:52has seen in cache. So, from time to time, you might want to remove, clear the cache of git.
34:00How to clear the cache of git? There is a command. It says git rm. Rm stands for remote.
34:07The flag is rf minus minus. The rf is the flag, minus minus cached, c-a-c-h-e-d,
34:15cached, c-a-c-h-e-d dot. Dot stands for this particular folder. And if you run this code,
34:23you will see that the cache has been cleared. So, now if I say git status.
34:30So, basically it clears of the cache. So, you can actually do a git add, git commit minus m,
34:41committing again. And then you will say git push origin master, your main. Everything is up to
34:54date. So, if you go over here, everything will be up to date. So, from time to time, you might
34:58have to clear up your cache. So, you clear up your cache using the git rm command. So, we also
35:04learned about how do we work with git ignore. Git ignore also has some other features. For example,
35:11there are some wildcards that you can use with git ignore. For example, let's say you want to
35:17ignore all JPEG files. So, you can say star dot jpg. That means do not include any JPEG files.
35:31I will have, let's say I have a folder called random. And in the random folder, I don't want
35:37to push any code that is in the random folder. Go to the random folder and inside the random folder,
35:44star means zero or more. Star is a wildcard. We have seen star while studying about regular
35:51expressions. So, that means I'm saying that any file which ends with a dot JPEG do not include it.
35:59Then any file which is inside the random. So, star dot star means any file where the name
36:06is zero or more characters and the extension is zero or more characters do not include this.
36:12So, now let's do that. Let's create a folder over here. Let's call this folder as random.
36:20And in this folder, let's keep some stuff. Let's keep some normalization queries inside my random.
36:32So, this is inside my git ignore. So, now if I run git status, you would see that only git ignore
36:40has been modified. Random is not being picked up anymore. Now, if you do everything again,
36:46git add, git commit, git ignore changes made. I'm doing my commit and I say git push.
37:01So, if I take a look at my status now, my local branch is one commit ahead.
37:07I will say git push origin master, my bad. And now if I go to my main branch,
37:16and if I refresh, you will not see the file. You will not see random anymore.
37:23Why? Because in my git ignore, I have mentioned that I will not include random. Also, I have
37:31mentioned that I will not include the file targets dot JPEG and I will not include anything that
37:38ends with JPEG. So, if I go to my this and if I say JPG, obviously there's no JPG.
37:45But what about targets? Not there. Target is not there. Random is not there.
37:55So, these folders are not there. You will use git ignore a lot by the way, okay? I have this
38:00project. So, somebody can download this project, this file on their computer and make changes to
38:08the file and would like to contribute the file back to me. I will teach you how you can clone a
38:17remote project into your file, into your local computer, make changes to the project and push
38:25the project back. So, I'll give you a link. You have to go to this particular link. Just copy that
38:33link on a browser tab. Okay. Now, what you can do is there is a button over here called fork,
38:43see? Fork. F-O-R-K. On top. So, just click on fork. Fork. And what is happening now? Guys,
38:55Tina, in her repository, she's creating a remote repository called SQL Python repo. So,
39:03create the fork. So, what has happened? Tina was now able to download the my repository into her
39:14repository. So, now if Tina goes to repositories, just look at the number of repositories that you
39:20have. Tina Thomas. You have three repositories. Out of the three repositories, one of the
39:30repositories is SQL Python repo. This repository was not coded by Tina. What did she do? She forked
39:37my repository. Now, this has also become part of her remote. Now, go to this repository. Now,
39:44once you are inside this repository, yeah, go to six commits. These will show you all the
39:51commits that have happened before Tina forked this repository into her repository. Right. So,
39:58these all commits were made by me. If it is a big project, you would see these commits being
40:03made by different people. Different people making these commits. Okay. Now, go back.
40:08There's a green color button called code. Click on this button. This button will give you the
40:17link to clone the repo. From here, it should be clear to you what to do, right? Click on the flow
40:23copy. Go to your git bash, cd dot dot one folder up. And here, right over here, you can say git
40:35clone. Enter. So, now what is happening? All now you do LS, do LS, list the files, LS, enter.
40:46You will be able to see a folder called SQL Python repo.
40:54Now, go to this folder called SQL Python repo cd.
41:05Very good. So, now you are inside the SQL Python repo folder. Now, do a git status.
41:13Now, go to your folder structure and make a change in that something. Make a change. So,
41:19go to your folder structure. Open the folder. Python. SQL Python repo.
41:28Go to any place. Click. Just right click and something. Yeah.
41:36Notepad. So, just copy this first four lines again. Yeah. Paste it again below.
41:49And write the word Tina at the very end of any one of the lines,
41:53just to know that you have made the change. Control S.
41:57OK. Now, what has happened? Tina had made changes in the working directory. These changes will be
42:04visible git. So, if she does a git status now, she will be able to see the changes. Git status.
42:11Nice. Right. So, now, she can do git add dot. Then she can do a git commit.
42:22So, she has made a commit. Now, what she has to do? She has to push the commit to the origin.
42:28Enter. Now, she has pushed the code to her remote. Now, can you go to the remote now? So, now, if you
42:40just refresh the page, do you remember the file where you made the changes?
42:49So, here you have made the changes and now you can see it in your repo.
42:54So, now, let's say Tina, me, we are all working on a project. So, now, what does Tina have to do now?
43:00Tina have to push this code changes to the original place from where she copied the repo.
43:06So, now, what will Tina do? Tina will make the changes in my repo. Tina has already made
43:12the changes in her repo. The project is working fine. Now, Tina will just click on this contribute
43:18thing. Let me see what comes up. So, what is it saying? It's saying that this branch is one
43:24commit ahead of puru project. Okay. So, now, you open a pull request. So, now, what is Tina doing
43:33in simple English? She is requesting me to merge her changes into my code because my code is the
43:40source from where everything happened. Right. So, basically, you basically write about your
43:44changes. You write description about your pull request and you say create pull request.
43:51So, now, what you have done? You have created a pull request. Okay. So, now, I will just go back
43:57to my screen. So, if I go over here and if I refresh, you see that I get one pull request.
44:06Right. Because the original code was coming from me, you know, I get one pull request.
44:11So, pull request. This is the Tina's pull request. Everything looks okay. So, there has to be some
44:19reviewers. Okay. So, before your pull request, there will be a bunch of reviewers. Those reviewers
44:24will basically review your code. Right. Okay. But because we are just doing a play thing now.
44:30So, you will have reviewers. You will assign some labels. What are the labels? The labels
44:35give information about your pull request because there will be many, many pull requests. Right. So,
44:40what I will do, I will merge the pull request and I will confirm the merge of the pull request.
44:46Now, once I have merged the pull request and if I go to my code and what was the name of the file?
44:55This one. Right. If I go to this particular file, you will see that now Tina's code has got merged
45:02with my code. I had a project. Tina forked the project. Tina cloned the project in her local
45:09repo. She made the changes. She did a add dot. She committed. She pushed the code from a local
45:17repo to the remote repo. Then she created a pull request. I got information about the pull request.
45:25I approved the pull request and merged the pull request. Now, Tina's code is merged with my code.
45:31This is day to day working of a software team. Be it data analytics, be it software development,
45:40be it testing, be it DevOps. This is how every team will work.
45:47You guys should name your repos properly. When you create a repo, give the repo a proper
45:52description. Right. Create a readme file. In the readme file, you write about your repo.
45:59What is your repo doing? What is the purpose of the repo?
46:03OK, so and then you will have a solid code base which you can showcase.
Be the first to comment
Add your comment

Recommended