Durai Git Exp 3
Durai Git Exp 3
To practice working with this command, use the terminal to navigate to your git practice
repository:
$ cd practice-git-
skillz
Next, run git status.
$ git status
On branch main
Your branch is up to date with
'origin/main'. nothing to
commit, working tree clean
1
23CS2503 - Git and Github for beginners Lab URK23CS1185
Notice that when you run git status it returns: working tree clean. This means that
there are no changes to any files in your repo - YET.
Next, open and make a small change to the README.md file in a text editor. Then, run the
command git status to check that changes have been made to your file(s).
$ git status
On branch main
2
23CS2503 - Git and Github for beginners Lab URK23CS1185
When you are not committing a lot of changes, you can create a short one line commit
message using the -m flag as follows:
git commit -m "Update title and author name in homework for week 3"
Creating branches
To keep track of changes to this file using git, you need to:
1. Clone the repository.
2. Move into the cloned repository
3. Create a new branch using the command (replace feature-branch with your desired
branch name).
4. git checkout -b feature-branch
5. Make modifications to files in your project.
6. Use git add to add the changes to the staging area
7. Commit the changes with a meaningful message
3
23CS2503 - Git and Github for beginners Lab URK23CS1185
Merging branches
To keep track of changes to this file using git, you need to:
1. Switch back to the main branch.
i. git checkout main
2. Merge the branch into the main branch
i. git merge feature-branch
3. Resolve conflicts (if necessary)
a. Open the conflicting files and resolve the conflicts manually.
b. After resolving conflicts, add the changes to the staging area and commit:
i. git add .
ii. git commit -m "Merge feature-branch into main"
4. Push changes to github using the following command.
i. git push origin main
Result:
Working with Version Control in software application development has been executed
successfully.