Open ghostbody opened 8 years ago
Sorry I look up on the Internet and PPT but still can't undestand this picture.
what is Arithmeic and its properties?
They are template instances. Think about when you make an instance for a class. They are just two specifications from a more abstract class template
1. What is Git?
Git is a version control software which is created by Linus who also created linux.In computer software engineering, revision control is any kind of practice that tracks and provides control over changes to source code. Software developers sometimes use revision control software to maintain documentation and configuration files as well as source code. Other version control software includes: VSS-- Visual Source Safe provided by Microsoft SVN-- CollabNet Subversion provided by CollabNet GIT-- Linus Torvald in order to mange the kernel version of linux at the very first time.
Version Control System
2. What is github?
Github is an open source community who has so many open source repository in it. People can work together in github, upload their code and also write documentations. You can happily work with people all over the world if you like. Also, there is also GitLab, GitBook, GitCoffee and GitOS.
3. Git and github?
Git is a version control software while github is a code hosting system using git as its version control system. Also github provides other functions like issues, wiki and git pages.
4. How to install git?
I recommend you to use command line git rather than a graphic one. In linux, you can just:
In windows, you are required to download git bash.
For graphic version, you can download github desktop. But I think it's not good enough for me, because it has some bugs I wonder.... Or command line is better, I think.
5. How to create and then update my code?
First, go to github to create a repository in your home page. Then github will give you some hint to initialize you repository. Generally:
Before this, you are required to config your username and email locally.
And also, you need to config your ssh key before you can upload you repository. In linux:
Input according to the hint of the program. You may just skip the inputs.
You will get a random string.
Go to setting:
Add your new key here using the random string you get.
Optionally, you can choose HTTPS as your transfer protocol, but you have to input username and password for each time when you need to modify remote repository.
If you have a local work repository, you can:
Look this is the workflow for you github work.
6. How to establish a collaboration with other persons?
There will be two ways: The first one, add a "collaborator". Enter you project setting page.
Click Collaborator:
Then you can invite user to your project and he will get all rights you have in the repository and he can update code himself.
The Second way is the same as contributing code for other open source repository.
6. How to contribute to other open source repository while I am not a collaborator?
First, fork the repository to your own space.
Then you can regard it as your own repository, and the coding with it using step 5. When you update the code(add new features or fix bugs or optimize the algorithm).
At last, you should make a "pull request" to the master of this repository. The system will auto compare your branch with the master's branch. Then, you can leave a comment and the code will submit to the master.
After some time, the master will accept your code, say "merge your pull request" or reject your code, maybe with some comments. If the owner or collaborators reject you code, he may comment on you commit with "blames".
Also, you can use this way for collaboration project which can protect the repository well.
pull request merged
7. Resolving conflicts.
One annoying thing is github is conflict.If the two branches you‘re trying to merge both changed the same part of the same file, Git won’t be able to figure out which version to use. When such a situation occurs, it stops right before the merge commit so that you can resolve the conflicts manually.
First, when you are in collaboration with others, you should always run
git pull
orgit fectch
before you commit you code. And also, you should not modify your teammates' part of code.If a conflict occurs, you must resolve it in this condition. The great part of Git's merging process is that it uses the familiar edit/stage/commit workflow to resolve merge conflicts.
Then, you can go in and fix up the merge to your liking. When you're ready to finish the merge, all you have to do is run git add on the conflicted file(s) to tell Git they're resolved. Then, you run a normal git commit to generate the merge commit. It’s the exact same process as committing an ordinary snapshot, which means it’s easy for normal developers to manage their own merges.
Note that merge conflicts will only occur in the event of a 3-way merge. It’s not possible to have conflicting changes in a fast-forward merge.
conflicts resolving is very annoying
8. Branches.
A branch, at its core, is a unique series of code changes with a unique name. Each repository can have one or more branches. In Git, branches are a part of your everyday development process. When you want to add a new feature or fix a bug—no matter how big or how small—you spawn a new branch to encapsulate your changes. This makes sure that unstable code is never committed to the main code base, and it gives you the chance to clean up your feature’s history before merging it into the main branch.
By default, the first branch is called "master".
Prior to creating new branches, we want to see all the branches that exist. We can view all existing branches by typing the following:
As stated in the beginning of this article, we want to have a development and a production setup for our coding environment.
We are going to treat the default "master" branch as our production and therefore need to create a single branch for development, or pre-production.
To create a new branch, named list-in-cpp in the repository "15-cpp-learning", type the following:
Use this command to switch back to master.
branches can make our collaboration job more clear: This is an overview of our open source desktop robot "Mebot"
You can also merge two branches as you like.
9. Issues, release, wiki and etc.
Code; The files of you repository
Issues: Some bug report, problems discussion can be placed here, while some people use it to write blogs, hhhhh.
Wiki: This is a place for you to have documentations and also some knowledge for you repository. You can make use of it.
Pulse and Graph is mainly some information about your repository including contribution information.
10. Using Markdown
You are required to learn some knowledge about markdown which is the main documentation language in github. You can focus on the content of you text rather than formats using a few symbols. You can have pretty formats, too.
Styling with Markdown is supported
11. Git pages
You can use git pages for you project description or for your personal blog. It's very easy to make it. Just create a repository named "your-user-name.github.io". And then upload htmls to the repository and then you can access the website "https://your-username.github.io".
If you want to use some more fashion way, I recommend you to use Jeklly which is a static blog tool written in Ruby. And github use this software to build you git pages. And also you can run your static anywhere outside github using Jeklly Server.
My github page blog
12. More
Interesting links:Git tutorial
Discuss here if you have any questions