Easy instruction guide to perform Version Control by ‘Git’ - For Web Developers

Easy instruction guide to perform Version Control by ‘Git’ - For Web Developers

02, Nov, 2018 | Apps | Wei Zhang | 2

If you haven’t used Git before, we strongly recommend it! Git is a system for web developers to use during software development. We find it especially useful when it comes to tracking changes in our source code and coordinating the work amongst the team here at YNW. As your likely already know, using the right software is key to doing a great job.

(Are you a web developer or graphic designer who is looking for work in Adelaide? Try reaching out to us here: info@ynw.com.au)

First things first,

Download Git

Choose your Operating System, and choose the newest version. Today, I used Git 2.19.1 on windows to do this.

Now, let’s get ready to do everything right the first time!

Step 1.

Run “Git Bash”. If you can’t find it, just search “git” on windows.

After you click ‘run,’ you’ll see a git command line just like the windows command line.

Before you proceed, input the command below to ensure you are updated with the latest version:

git clone https://github.com/git/git

Now, here are some basic command line commands you will need for Git: cd c:/some_folder/ Go to the directory after the command

cd.. Go to parent directory

cd /sub_folder Go to sub-directory

-x When you see a command followed by a “-” plus a letter, it means that the arguments for the command which allow for the command to perform the behavior in a different way. For example: “git push -f ” means Force to Update remote refs along with associated objects ignore warnings.

Here is a list of some commonly used Git commands:

config help init clone fetch pull push remote diff clean

2. Find the Local Repository directory (Or the directory which stores your projects), for example: cd C:/Users/WEI/Documents/NetBeansProjects


*“/” is used for specifying different level directories in the command line, not “\”.

*If your directory or path includes using a space, command line will not recognize it as a directory or path, type in “\” before you type space, then the system will recommend you the correct one.

After you have reached the target directory, and have used command “git init” to label the version control in this folder….You will find that a new “.git” folder appears in that directory….And the directory is now called “Master.”

3. Now that you have the initial git local repository, you will need to confirm and add-in which projects will be included in the version control.

Type in the command “git commit -a” then “git add -A” to commit all files and folders in “master” or, simply choose the one you want by giving a specific directory and file option.

4. Now you have the local “master” folder, but you also need an “origin” folder from an online server to store and synchronize all the changes for your projects. Many companies provide the free server for version control, GitHub is free but they will public your codes. I recommend BitBucket repository. They provide a free private online repository service. Register it through the following URL: Register Bitbucket

When you have finished the registration, you should be able to create a new repository in your bitbucket dashboard page by a “+” button on the top left of the page. Then name your repository, then it turns to the repository home page. You will see a URL like https://mygitexpample@bitbucket.org/myaccount/web_projects.git which will be followed by a “.git”. This is your online repository path which also called “origin” by git.

Tap in the following command into Git Bash to set up the “origin” to Git:

git remote add origin https://mygitexpample@bitbucket.org/myaccount/web_projects.git

5. Congratulations! You have set up all the basic things to “git” up and running. You can now use the command to push your files to the server.

git push -u origin master

For more specific operating on Git, please read the document. Git Documentation

For different settings in various IDEs, I will upload another post at a later date.

Web Design | Graphic Design | Apps | Software | Blog | Fashion

Like our post?
share it

We will be so proud if you share our post to your social media, also you can leave some comments below.


Lion Commented 883 days ago

I made a mess and fond there are something already in the origin, so the system does not allow me to push my project in.

Cazz Commented 893 days ago

Thank you, It easy to follow and it works.

Wei Commented 883 days ago

If you are sure about the data in origin is invalidate, you can use {git push -f -u origin master}to overwrite them.

Leave a comment