# Git + GitHub Notes — Page 2
## Notes
(10) Again, I’ll make commit to check how some new changes to Git history.
git add .
git commit -m "updated xxx.yyy"
(11) git restore [filename]
→ to discard changes.
Again: git add and so on, so forth.
(12) git restore --staged filename
git restore filename → then change back [??]
(13) git branch
• Instead of doing some work on main branch we can do it on independent branch.
(14) git branch
→ It will show: current/available branches
(15) git switch
(16) git ls-files
→ files to be tracked by Git.
• If you want to merge the changes you have done in your branch [to the main branch]:
git switch master
(17) git merge [branch]
It will make [changes] from new branch to be applied on "master" branch.
(18) git branch -d [branch]
(delete branch)
(19) If you have some file on one branch, you pushed to main branch & again if you try to push the same file from another branch into main branch, then that is: [merge conflict].
## Main Commands Visible on This Page
git add .
git commit -m "..."
git restore
git restore --staged
git branch
git switch
git ls-files
git merge
git branch -d
## Branching Workflow
main branch
|
+---- new branch
|
make changes
|
commit changes
|
merge into main
|
main branch
## Key Concept
**merge conflict**: when changes from different branches affect the same file or the same part of a file, Git may require the conflicts to be resolved before the branches can be merged.
« Previously
Next »
Pages
- Index of Lessons in Technology
- Index of Book Summaries
- Index of Book Lists And Downloads
- Index For Job Interviews Preparation
- Index of "Algorithms: Design and Analysis"
- Python Course (Index)
- Data Analytics Course (Index)
- Index of Machine Learning
- Postings Index
- Index of BITS WILP Exam Papers and Content
- Lessons in Investing
- Index of Math Lessons
- Index of Management Lessons
- Book Requests
- Index of English Lessons
- Index of Medicines
- Index of Quizzes (Educational)
Thursday, September 24, 2026
Git and GitHub Notes by Megha (Pg2)
« Previously
Next »
Labels:
GitHub
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment