Posts

Showing posts from May, 2019

Getting started with GIT – Part 5

Image
This is the 5th part of the getting started with GIT tutorial series. Here we will explorer some most important functions of GIT. This is a continuation from the last part "Getting started with GIT – Part 4 ". Lets see how to get old version of our project. First I am going to view all my commits using “ git log ” command. Currently my website looks like this. Now I am going add another main content area to my website. And commit those changes to the repository. And again, I am going to add another(fourth) main content are to my website and commit those changes. Now let’s check our git log. Now website looks like this. So, we assume we only need 3 main content blocks and we want to go back to the commit where we had only 3 main content blocks. We can achieve it by checkout the version with only 3 content areas. So, we can use command “ git checkout <commit number> -- <the file name> ”. So,...

Getting started with GIT – Part 4

Image
Welcome Back!!! to the part 4 of git tutorial series. This part is going to be a short one. In previous parts we used some text files as our project. In this tutorial we are trying work with a small project. For the project I am going to use a basic HTML website I made. So, first thing we need to do is turning our normal folder which contains project files into git project. So, I am going to open up the git bash and navigate to the project folder using “ cd ” command. Initiate the git repository using the command “git init”. Now try “ git status ” command. You will notice that we have our files listed under untracked files. So, we should add those files using “ git add ” command. Period is used to add all the files. Then we should commit. Now, all set for learning new stuff. Let’s learn how to undo changes done to our working directory. First let’s look at the current status of our website. Let’s say I accidentally...

Getting started with GIT – Part 3

Image
This is the part 3 of tutorial getting started with git. Now let’s see how to delete files. We can use “ git rm <files name> ” command to delete files. Let’s commit the changes we made. Note: Here, you may notice that we did not add our changes to staging area. That is because when we use “git rm” command, it already adds the deleted file to the staging are. Let’s learn how to rename and move files. First, we are going to rename a file as we normally do. I am going to rename the “first.txt” file into “index.txt”. Let’s see what git thinks about the renaming we did. You can see git thinks that we deleted the first.txt file and added another file called index. So, we can act according to git. Now we are going to add the index.txt file and remove the first.txt file. If we check the status now using “ git status ”, you will notice that git has realized what we actually did was renaming the file. As always commi...