This repository contains the solutions for Assignment 1, focusing on setting up a local Git repository, creating commits, branching, merging, and pushing to a remote repository.
- Create a new directory on your local machine.
- Initialize a new Git repository in the directory using the command:
git init
.
- Create a new text file named "file1.txt" within the repository directory.
- Add some content to "file1.txt".
- Add the file to the staging area using the command:
git add file1.txt
. - Commit the changes with a descriptive message using the command:
git commit -m "Add file1.txt"
.
- Create a new branch named "feature" using the command:
git branch feature
. - Switch to the "feature" branch using the command:
git checkout feature
. - Make changes to "file1.txt" by adding additional content.
- Commit the changes on the "feature" branch.
- Switch back to the master branch using the command:
git checkout master
. - Merge the changes from the "feature" branch into the master branch using the command:
git merge feature
. - Resolve any conflicts that may arise during the merge process.
- Create a remote repository on a hosting platform (e.g., GitHub, GitLab).
- Add the remote repository URL as a remote named "origin" using the command:
git remote add origin <remote-url>
. - Push the local repository to the remote repository using the command:
git push -u origin master
.
To complete Assignment 2, follow the steps below:
- Share your local repository with a partner or colleague.
- Have them clone the repository to their local machine.
- Have them create a new branch, make changes, and commit them.
- Fetch and merge their changes into your local repository.
- Resolve any conflicts that may arise during the merge process.
- Push the local repository to the remote repository using the command:
git push -u origin master
.
- Clone this repository to your local machine.
- Complete the assignments as described above.
- If working with a partner for Assignment 2, ensure effective communication for collaboration.
- Ensure to follow best practices in commit messages, branch naming, and resolving conflicts.
Feel free to reach out for any clarifications or assistance!