Version Control with Git
Version Control with Git
Activity Steps:
1. Set up the Repository:
o Visit the GitHub repository link provided:
VITB-SE/Software-Engineering.
o Clone the repository locally using:
bash
git clone https://github.com/VITB-SE/Software-Engineering.git
2. Task Identification:
o Add a README file: Create a file named README.md to
introduce the project. Include basic details such as:
Project name
Purpose
How to contribute
o Update code: Add some sample code files or placeholders
to simulate team contributions.
3. Basic Git Commands:
o After creating or modifying files, use the following
commands:
bash
git add <filename> # Stage the changes
git commit -m "Add README file" # Commit the changes with a
message
git push # Push changes to the remote repository
4. Branching and Merging:
o Create a new branch for adding features or fixing bugs:
bash
git checkout -b feature-branch
o Make changes and push the branch:
bash
git push origin feature-branch
o Merge the branch into the main branch:
Bash
git checkout main
git merge feature-branch
5. Discuss Resolving Merge Conflicts:
o Simulate a merge conflict by modifying the same line in a
file on two different branches.
o Try to merge the branches:
bash
git merge conflicting-branch
o When a conflict arises, resolve it by manually editing the
file and marking it as resolved:
bash
git add <filename>
git commit
o Push the resolved changes to the repository.