SCM or VCS Confusingly the abbreviations SCM and VCS are often used

Scm or vcs confusingly the abbreviations scm and vcs

This preview shows page 506 - 507 out of 517 pages.

SCM or VCS? Confusingly, the abbreviations SCM and VCS are often used interchangeably. We will be using Git for version control. Cloud-based Git hosting services like GitHub, while not required for Git, are highly desirable because they enable small teams to collaborate conveniently (as Chapter 10 describes) and give individual developers a place to back up their code. This section covers the basics of Git. The next section covers basic setup instructions for GitHub, though other cloud-based Git services are available as well. Linus Torvalds invented Git to assist with version control on the Linux project. You should read this section even if you’ve used other VCSs like Subversion, as Git’s conceptual model is quite different. Like all version control systems, a key concept in Git is the project repository , usually shortened to repo , which holds the complete change history of some set of files that make up a project. To start using Git to track a project, you first cd to the project’s top-level directory and use the command git init , which initializes an empty repo based in that directory. Tracked files are those that are a permanent part of the repo, so their revision information is maintained and they are backed up; git add is used to add a file to the set of tracked files. Not every project file needs to be tracked—for example, intermediate files created automatically as part of the development process, such as log files, are usually untracked. Screencast A.6.1 illustrates the basic Git workflow. When you start a new project, git init sets up the project’s root directory as a Git repo. As you create files in your project, for each new file you use git add filename to cause the new file to be tracked by Git. When you reach a point where you’re happy with the current state of the project, you commit the changes: Git prepares a list of all of the changes that will be part of this commit, and opens that list in an editor so you can add a descriptive comment. Which editor to use is determined by a configuration setting , as described below. Committing causes a snapshot of the tracked files to be recorded permanently along with the comments. This snapshot is assigned a commit ID , a 40-digit hexadecimal number that, surprisingly, is unique in the universe (not just within this Git repo, but across all repos); an example might be 1623f899bda026eb9273cd93c359326b47201f62 . This commit ID is the canonical way to refer to the state of the project at that point in time, but as we’ll see, Git provides more convenient ways to refer to a commit besides the cumbersome commit ID. One common way is to specify a prefix of the commit that is unique within this repo, such as 1623f8 for the example above. The SHA-1 algorithm is used to compute the 40-digit one-way hash of a representation of the entire tree representing the project at that point in time.
Image of page 506
Image of page 507

You've reached the end of your free preview.

Want to read all 517 pages?

  • Spring '19
  • Dr.Marcos

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors