Unformatted text preview:

Git and GitHub Tutorial The Ultimate Guide to VC Branching Merging Pull Git as a Version Control System Notes Importance of Username and Global Name Request A username and global name are important in Git as they are used to identify the commits made by a user It is recommended to set a global username and email using the following commands git config global user name Your Name git config global user email Importance of Username and Global Name When using Git and collaborating with others it is essential to set up a username and global name for tracking contributions Here s why Identification A username and global name allow others to identify who made specific changes in a repository Credibility Having a clear identity attached to your contributions can help build credibility within the open source community Accountability A unique username and global name hold individuals accountable for their code and actions in the project Setting Up a Username and Global Name To set up your username and global name 1 Open the terminal or command prompt 2 Run the following commands git config global user name Your Name git config global user email youremail example com Replace Your Name and youremail example com with your actual name and email address Git Fundamentals Git as a Version Control System Git is a powerful version control system that enables efficient tracking and management of changes in codebases Untracked Folders Similar to untracked files folders without any tracked content will not be included in Git s version control Local and Remote Repositories Local A local copy of your repository which you can access and modify directly from your computer Remote A central online repository accessed via cloud based hosting services like GitHub or GitLab Basic Git Operations Visual Studio Code for Git Operations Visual Studio Code VS Code is an integrated development environment IDE that provides Git features and extensions for easy management Creating a New Repository git init This command initializes a new repository allowing you to begin tracking changes Handling Conflicts and Merge Issues Handling Conflicts When two branches modify the same section of code Git may flag it as a conflict You ll need to manually resolve these conflicts Resolving Merge Issues After resolving conflicts stage the changes with git add Finally commit the changes git commit m Resolved conflicts Push the merged branch to the remote repository to share your changes with collaborators Visual Studio Code for Git Operations Creating a New Repository When creating a new repository in Visual Studio Code VS Code follow these steps 1 Open VS Code and click on the Source Control tab on the Activity Bar 2 Click on the button at the top left of the Source Control tab to create a new repository 3 Choose a folder for your repository and give it a name 4 Select the Initialize repository with a README option if you want to create a README md file 5 Click on the Create button to create the new repository Importance of Username and Global Name When using Git as a version control system it is important to set a username and global name The username and global name are used to identify commits made in a repository To set your username and global name in Git use the following commands in your terminal or command prompt git config global user name Your Name git config global user email youremail example com Untracked vs Untracked Folders When working with a Git repository untracked files and folders are files and folders that have not been added to the repository yet To add untracked files and folders to the repository use the git add command followed by the name of the file or folder Local and Remote Repositories Git repositories can be either local or remote A local repository is stored on your computer while a remote repository is stored on a server such as GitHub or GitLab To connect a local repository to a remote repository use the git remote add command followed by the name of the remote repository and its URL Handling Conflicts and Resolving Merge Issues When working with Git conflicts can arise when two or more people make changes to the same file To resolve conflicts follow these steps 1 Pull the changes from the remote repository to your local repository 2 Open the conflicted file and look for conflict markers 3 Decide which changes to keep and which to discard 4 Remove the conflict markers and save the file 5 Add and commit the changes Visual Studio Code has built in support for handling conflicts and resolving merge issues


View Full Document

Anna CS 3291 - GitHub-part 1

Download GitHub-part 1
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view GitHub-part 1 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view GitHub-part 1 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?