Repository navigation
Getting Started with Our Repository in VSCode #6
Closed
doctorbanu
started this conversation in
General
Replies: 2 comments 1 reply
|
Hi guys! 🙋🏻♀️ I added a guide for Git commands that can be useful for us. And I tried to include the important things to keep in mind. I know it seems a little bit too long, but I am going to add a summary for it. However, it could be better if you can check the original version. |
1 reply
|
We added this to Notes Folder. Thank you Banu! |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
A Beginner's Guide to Working with Git Repos in VSCode
🖇️ Cloning the Repository 🖇️
a) We can open VSCode, and on the main page, click on
"Clone Git Repository".
b) Alternatively, we can open the terminal and run the following command
for our Repo:
git clone https://github.com/MIT-Emerging-Talent/ET6-foundations-group-05.git🌿 Branch Creation and Commands for Branch Management 🌿
a) Check status of our working directory and staging area
git statusb) Check existing branches (local)
git branchc) Check all branches (local and remote)
git branch --alld) Update our local repository to the latest version of main
git pull origin maine) Merge another branch into your current branch
git merge another_branch_namef) To switch between branches
git switch name_of_wanted_branchg) Create a new branch and switch to it
git checkout -b name_of_new_branchgit branch name_of_new_branchgit switch name_of_new_branchh) Delete branches
git branch -d branch_namegit branch -D branch_namegit push origin --delete branch_name🚀 Making and Pushing Changes to GitHub 🚀
1. Staging Changes
❗Avoid using
git add .include unrelated files or changes and cause conflicts.
Preferred Alternative: Add specific files only with:
git add folder_name/file_name2. Committing Changes
git commit -m "Descriptive message, e.g., Added solution and tests for challenge_name"3. Pushing to GitHub
git push origin branch_name🔄 Pull Requests and Reviews 🔄
1. Creating a Pull Request (PR)
a) If our branch is recently pushed, GitHub will display a Compare & Pull Request
button.
b) Alternatively, we will:
2. Reviewing a Pull Request
If we are reviewing someone else's pull request. We will:
🔗 Merging 🔗
Once the PR is approved, we need to click the green "Merge pull request" button
and then "Confirm merge". After successful merge, our changes will be added to
the main branch.
🎉 And, congratulations! Once the PR is merged, our solution is part of the repository.
Handling Merge Conflicts
If we get conflicts while merging main into our branch:
git switch mainand then,git pull origin maingit switch our_branchgit merge mainwhich files have conflicts that need to be resolved.
conflict markers (like <<<<<<<, =======, and >>>>>>>). We need to edit the files
manually to resolve the conflicts and keep the desired changes.
need to add those files to the staging area:
git add resolved_filegit commit -m "Merge main and resolve conflicts"All reactions