在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:INFO-201/m4-git-intro开源软件地址:https://github.com/INFO-201/m4-git-intro开源编程语言:开源软件介绍:Module 4: Introduction to Git and GitHubOverviewBeing able to manage changes to your code and share it with others is one of the most important technical skills a programmer can learn. Unfortunately, a frightening number of people still email their code, have dozens of versions of the same file, and lack a system for backing up their code. This is both time consuming and error prone. Luckily, there are wonderful tools for tracking changes to your code (git), and for facilitating collaboration (GitHub). Git and GitHub are the industry standards for these family of tasks which we'll refer to as version control. Contents Resources
Git
All of the files in a project directory (referred to as a Git allows you to roll back to a previous snapshot of your project called a Here is additional information on each (of these)
So far, the process described all occurs on your local machine. This is a good practice, but does not facilitate collaboration with others, or create a backup of your code. For these purposes, we'll use GitHub. GitHubIn order to share our code and collaborate with others, we'll need a publicly accessible (cloud) location where we can store our files (and file history) -- that's what GitHub is for. GitHub is the most popular open-source web-based repository hosting service. In addition to providing a great UI on top of a server that hosts your repositories, GitHub has a number of additional features such as issue tracking, wiki pages, and notifications that make it a great collaboration tool. The important thing to keep in mind is that GitHub doesn't just store the a copy of your code files in your repository -- it stores the entire database of changes to the files. This allows other developers to view the files at an earlier point in time. ConfigurationBefore we can begin using git and GitHub together, we'll need to sign up for a GitHub account, and then use our terminal to configure your machine for your GitHub account. This tells your machine which GitHub user you are, granting you permission to your own repositories. You'll only need to do this once on your own machine, though if you are using another computer (lab machine), you'll need to remember to do it. Once you open your terminal, you'll need to specify your name and GitHub username: # Enter YOUR NAME to set your name
git config --global user.name "YOUR NAME"
# Enter YOUR EMAIL to set your email. Make sure it is the email associated with your GitHub account!
git config --global user.email "YOUR EMAIL" See this article for more information on setting up GitHub. Workflow ExampleHere is one example of a workflow you may choose when working with a project. Let's imagine that there's a repository online that you want to use as a starting point for a project (this is how we will do class/lab exercises). First, you may want your own cloud copy of a repository on GitHub. To create your own copy, you'll simply click the fork button in a GitHub repository: That will create a copy of the entire repo on your GitHub account. In order to start working on the files, you'll need to get them on your computer (they're still only in the cloud). To do so, you will clone your forked repository (not the original one) to your machine. This will create a local copy of the files as well as their entire history on your local machine. We'll use the terminal to clone the repository, but we need to get some information about it first. To get the URL location of the repository, click the Clone or Download button, then click on the clipboard icon to copy the URL to your clipboard: Then, on your terminal, you could use the Here are additional
Course Assignments on GitHubAssignments in this course are configured using the GitHub Classroom application. Each student should click on the appropriate link in Canvas to create a new private repository on their GitHub account: this should happen automatically. Private repositories are accessible by TAs and instructors. Once the repository is created, you should be able to follow these simple steps from above:
Repeat steps 3 - 5 each time you want to make a checkpoint of your work and save that snapshot (commit) locally and in the cloud. Using git and GitHub can be challenging, and you'll inevitably run into issues. While it's tempting to ignore version control systems, they will save you time in the long-run. For now, do your best to follow these processes, and read any error messages carefully. If you run into trouble, try to understand the issue (Google/StackOverflow), and consult other for help. To practice using these basic commands, see exercise-1. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论