Title: Git and GitHub Version Control Experiment
The objective of this experiment is to demonstrate the basics of version control using Git and GitHub. We will create a simple repository, make changes to files, commit those changes, and push them to a remote GitHub repository.
Git installed on your local machine. You can download it from
- A GitHub account. You can sign up for free at https://github.com.
Step 1: Set up Git ConfigurationOpen a terminal or command prompt and run the following commands to configure your Git identity:
git config --global user.name "Your Name"
git config --global user.email "email@example.com"
Step 2: Create a Local Git Repository
- Create a new directory on your local machine for the project.
- Navigate to the project directory using the terminal.
- Initialize a new Git repository:
Step 3: Create a Sample File
- Create a simple text file called sample.txt in the project directory with some content.
Step 4: Add and Commit the File
- Add the file to the staging area:
git add sample.txt
- Commit the changes with a meaningful message:
git commit -m "Add sample.txt file"
Step 5: Create a GitHub Repository
- Go to https://github.com and log in to your GitHub account.
- Click on the "+" icon in the top right corner and select "New repository."
- Give your repository a name and optional description, then click "Create repository."
Step 6: Link Local Repository to GitHub Repository
- In the terminal, add the remote URL of the GitHub repository to your local repository:
git remote add origin <GitHub_Repository_URL>
Step 7: Push Changes to GitHub
- Push the committed changes to the remote GitHub repository:
git push -u origin master
Step 8: Make Changes and Push Again
- Edit the sample.txt file and add some new content.
- Save the changes and commit them:
git add sample.txt
git commit -m "Update sample.txt file"
- Push the changes to the GitHub repository:
Step 9: Check GitHub Repository
- Open your GitHub repository in the browser and verify that the changes you made locally are reflected in the repository on GitHub.
In this experiment, you learned the basic workflow of using Git and GitHub for version control. You created a local Git repository, added and committed files, linked it to a remote GitHub repository, and pushed changes to GitHub. This simple example demonstrates the power and convenience of version control in collaborative software development.