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: firstname.lastname@example.org)
First things first,
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!
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://email@example.com/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://firstname.lastname@example.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.