Automated Version Control
|
|
Setting Up Git
|
|
Creating a Repository
|
|
Tracking Changes
|
Atom’s Git extension (typically displayed in the right pane of the editor) shows the status of a repository.
Files can be stored in a project’s working directory (which users see), the staging area (where the next commit is being built up) and the local repository (where commits are permanently recorded).
Staging files indicates that you want them to be tracked. Leaving files unstaged allows you to not track changes you don’t care about
Committing saves staged content in the local repository, preserving the state of your project at a particular point in time. This is similar to taking a photograph.
Write a commit message that accurately describes your changes.
|
Ignoring Things
|
|
Git Remotes
|
A local Git repository can be connected to one or more remote repositories.
Use the HTTPS protocol to connect to remote repositories until you have learned how to set up SSH.
Pushing copies changes from a local repository to a remote repository.
Fetching checks for changes in the history of a remote repository and copies data about those historical events to a local repository.
Pulling copies file changes from a remote repository to a local repository.
|
Exploring History
|
Differences between commits can be examined using the History tab in GitHub Desktop. You can look at diffs on the GitHub website side by side by right-clicking on a commit and then clicking on View on GitHub.
You can examine the state of your repository at a particular time by clicking Browse files when comparing differences between files on GitHub’s website.
You can recover old versions of files by reverting changes.
|
Collaborating
|
Copying a remote repository to create a local repository is called cloning.
Collaborators can either have direct access to a repository, or make changes that are mediated by pull request reviews.
|
Conflicts
|
Conflicts occur when two or more people change the same lines of the same file.
The version control system does not allow people to overwrite each other’s changes blindly, but highlights conflicts so that they can be resolved.
|
Putting It All Together
|
|
Licensing
|
Ensure that your manuscript or source code is assigned a license from the onset to avoid issues down the line.
Ensure that you have the legal right to assign a license before assigning one.
Multiple websites list very good options for open source licenses. Unless you are actively consulting with a lawyer, it is best to use one of these licenses or another established license.
|
Citation
|
|
Hosting
|
Projects can be hosted on university servers, on personal domains, or on public forges.
Rules regarding intellectual property and storage of sensitive information apply no matter where code and data are hosted.
|