- 1. How to get a Git repository
- 2. How to update files from Git repository
- 3. How to manage projects in remote Github repository
- 4. How to update changes to remote Github repository
- 5. How to update changes from remote Github repository to local project folder
Here I just list few common issues for now I encountered when I use Git and Github.
How to get a Git repository
For example, I need to get the Jacman theme for this blog.
I need to get to my blog’s local themes folder:
How to update files from Git repository
For example, I want to update Jacman theme, I can:
How to manage projects in remote Github repository
For example, I want to upload my blog’s source files to remote Github repository
- I need to create a repository on Github named blog first. (same as your local blog folder)
Get to your local blog folder and create local git repository:12345$ cd blog$ git init //initial repository$ git add . //add all files to the index$ git commit -m "add all files" //commit files to repository//Tip: you have to add at least one file to the repository before committing
Set the remote address of git repository: (get the address when you create the repository on Github)1$ git remote add origin email@example.com:woaij007/blog.git
upload files to remote Github repository1$ git push origin master
How to update changes to remote Github repository
For example, I made some changes to my local blog files and I need to update them to my Github repository:
check the changes of your local repository:12$ cd blog$ git status
For example I get message from git like: “modified: source/_posts/Test.md”, then I will need to:123$ git add source/_posts/Test.md$ git commit -m "update test file"$ git push origin master
How to update changes from remote Github repository to local project folder
Difference between Git and Github
And the last issue is that what’s the difference between Git and Github we mentioned above: (Below is what I get from stackoverflow)
Git is a revision control system, a tool to manage your source code history. GitHub is a hosting service for Git repositories. So they are not the same thing: Git the tool, GitHub the service for projects that uses Git.
What is Git:
“Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency”
What is GitHub:
“GitHub is a web-based Git repository hosting service, which offers all of the distributed revision control and source code management (SCM) functionality of Git as well as adding its own features.”
Github provides access control and several collaboration features such as wikis, task management, and bug tracking and feature requests for every project.
You do not need GitHub to use Git.
Git = Local (on you computer), GitHub = Remote (web).
Github allows you to:
- Share your repositories with others.
- Access other user’s repositories.
- Store remote copies of your repositories (github servers) as backup of your local copies.