sflasas.blogg.se

Git bash tutorial for beginners py file
Git bash tutorial for beginners py file













So if you have three commits in your repo, this is how they will look like, conceptually.

git bash tutorial for beginners py file

Note that I could have staged both files before I commit, but I chose not to so I can illustrate to you that only changes in the staging area are considered when you commit.īy now, you should have two commits in your repo.Įach commit you make is stored in the git repo with a pointer to its parent commit, much like how a linked list would look like. Let’s also stage and commit the README.md.

git bash tutorial for beginners py file

To create a commit, you use the git commit command and you also provide a nice, descriptive message about this commit. In our case, there is one change that we staged and that is creating a new file hello.pyĮven though we also created a README file, git will not see the new file until it is staged as well. These changes could be adding, removing, or modifying the contents of a file. Third: Committing your changesĬommitting your changes is the actual act of taking a snapshot of your code.īut again remember that this snapshot will only contain the changes in the files that you have staged in the previous step.

GIT BASH TUTORIAL FOR BEGINNERS PY FILE CODE

Staging a file means that you are telling git to take the changes in that file into consideration the next time you take a snapshot of your code.įor example, to stage hello.py, you run the git add command.Ĭool, now git knows that the next time you take a snapshot of your code hello.py will be included. To tell git to take a snapshot of your code, you do so by first staging the files that you created or modified and then committing them. The reason your git repo is empty is because you need to explicitly tell git to take a snapshot of your code.Įach snapshot (or version) of your code is called a commit and each commit is uniquely identified by a hash which is a function of the content of your source files, some metadata, and other things. The first rule of git is, your working directory is NOT your repo It’s time to start actually writing code!įor simplicity, let’s create a README.md file and a Python hello world program hello.pyīy creating these two file, you have populated your directory. Just head to the helloworld directory and run the git init command:

git bash tutorial for beginners py file

Now because you are a smart person, you know that you need to create a git repo in order to version control your source code. So you go ahead and create a directory called helloworld where you will store all your project source files. Let’s say you want to start working on a new coding project. You don’t even need an internet connection. In this step, all you need is your laptop. The reason is that many beginners confuse git with Github.īy pretending that Github doesn’t exist, you will be able to gather the git concepts much faster. To avoid any confusion, and to make sure that your learning process starts out with the right mindset, I want you to completely forget that Github exist. Step 1: Forget about Github, learn git locally I will do this by walking you through a very basic tutorial.įor each step, I’m going to cover the basics but it’s up to you to go ahead and make sure you understand each topic in depth by fiddling with git yourself and reading more resources.įollow these steps, in the presented order, and make sure you study each step thoroughly before you move on to the next one. In the rest of this article, I will cover the 5 steps that you need to progress through while learning git. So now that you are sold on the importance of git, how do you learn git? And this is likely to last for some serious time. With that said, git is the most popular version control system there is nowadays. Version control systems facilitate collaborative development.ĭevelopment as a team would have been a nightmare without systems like git (and others). If your newest version is not working for whatever reason (may be it’s that new hire), you can easily roll back to a version of the code that you know is working. Since a version control system allows you to have different versions of your source code. What is git?Ī version control system, in the simplest terms, allows you to maintain different versions (snapshots) of your code while your code is growing.Īnd this gives you the following benefits. And one of the most important tools that programmers use every single day is git.

git bash tutorial for beginners py file

Programmers need tools to assist them with their work. Being an excellent programmer is not only about learning programming.













Git bash tutorial for beginners py file