Update GIT_ASSIGNMENT.md
This commit is contained in:
@@ -307,6 +307,97 @@ index 5a4b868..0000000
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
# 7. Creating & Switching Branches
|
||||||
|
|
||||||
|
Assignment:
|
||||||
|
|
||||||
|
Create a branch feature/feature-1:
|
||||||
|
|
||||||
|
git branch feature/feature-1
|
||||||
|
git checkout feature/feature-1
|
||||||
|
|
||||||
|
Add a line to notes.txt and commit it.
|
||||||
|
|
||||||
|
Switch back to main:
|
||||||
|
|
||||||
|
git checkout main
|
||||||
|
|
||||||
|
Observe how the file content changes.
|
||||||
|
|
||||||
|
### My Work
|
||||||
|
`git branch feature/feature-1`
|
||||||
|
`git checkout feature/feature-1`
|
||||||
|
### Result
|
||||||
|
`Switched to branch 'feature/feature-1'`
|
||||||
|
#### Result
|
||||||
|
```
|
||||||
|
Magdel@LAPTOP-NS5FVUS9 MINGW64 ~ (feature/feature-1)
|
||||||
|
$ git branch
|
||||||
|
* feature/feature-1
|
||||||
|
master
|
||||||
|
```
|
||||||
|
|
||||||
|
###My Work
|
||||||
|
```
|
||||||
|
echo "This note was made on 23rd August 2025" >> notes.txt
|
||||||
|
git add notes.txt``
|
||||||
|
|
||||||
|
#### Result
|
||||||
|
```
|
||||||
|
Magdel@LAPTOP-NS5FVUS9 MINGW64 ~ (feature/feature-1)
|
||||||
|
$ git status
|
||||||
|
warning: could not open directory 'Application Data/': Permission denied
|
||||||
|
warning: could not open directory 'Cookies/': Permission denied
|
||||||
|
warning: could not open directory 'Documents/My Music/': Permission denied
|
||||||
|
warning: could not open directory 'Documents/My Pictures/': Permission denied
|
||||||
|
warning: could not open directory 'Documents/My Videos/': Permission denied
|
||||||
|
warning: could not open directory 'Local Settings/': Permission denied
|
||||||
|
warning: could not open directory 'My Documents/': Permission denied
|
||||||
|
warning: could not open directory 'NetHood/': Permission denied
|
||||||
|
warning: could not open directory 'PrintHood/': Permission denied
|
||||||
|
warning: could not open directory 'Recent/': Permission denied
|
||||||
|
warning: could not open directory 'SendTo/': Permission denied
|
||||||
|
warning: could not open directory 'Start Menu/': Permission denied
|
||||||
|
warning: could not open directory 'Templates/': Permission denied
|
||||||
|
On branch feature/feature-1
|
||||||
|
Changes to be committed:
|
||||||
|
(use "git restore --staged <file>..." to unstage)
|
||||||
|
modified: notes.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
### My Work - Commit
|
||||||
|
`git commit -m "New Note"
|
||||||
|
|
||||||
|
#### Result
|
||||||
|
```
|
||||||
|
Magdel@LAPTOP-NS5FVUS9 MINGW64 ~ (feature/feature-1)
|
||||||
|
$ git commit -m "New Note"
|
||||||
|
[feature/feature-1 d2ef265] New Note
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
```
|
||||||
|
###My work
|
||||||
|
`git checkout master`
|
||||||
|
#### Result
|
||||||
|
```
|
||||||
|
Magdel@LAPTOP-NS5FVUS9 MINGW64 ~ (feature/feature-1)
|
||||||
|
$ git checkout master
|
||||||
|
Switched to branch 'master'
|
||||||
|
```
|
||||||
|
|
||||||
|
# 8. Cloning a Remote Repository
|
||||||
|
|
||||||
|
Assignment:
|
||||||
|
|
||||||
|
Go to Git Comorin and verify your repo in Git-Training-Hub exists.
|
||||||
|
|
||||||
|
Run:
|
||||||
|
|
||||||
|
git clone <your-repo-url> cloned-repo
|
||||||
|
|
||||||
|
Verify by listing files inside cloned-repo.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user