Update GIT_ASSIGNMENT.md
This commit is contained in:
@ -453,6 +453,112 @@ origin https://git.comorin.co/Git-Training-Hub/git-practice-Mag.git (push)
|
||||
|
||||
```
|
||||
|
||||
# 10. Pushing & Pulling Changes
|
||||
|
||||
Assignment:
|
||||
|
||||
Push local commits to Git Comorin:
|
||||
|
||||
git push -u origin main
|
||||
|
||||
Edit a file directly on Git Comorin and commit it there.
|
||||
|
||||
In your local repo, run:
|
||||
|
||||
git pull origin main
|
||||
|
||||
Verify that the local file updates.
|
||||
|
||||
### My work
|
||||
```
|
||||
Magdel@LAPTOP-NS5FVUS9 MINGW64 ~/cloned-repo (main)
|
||||
$ git push -u origin main
|
||||
```
|
||||
|
||||
#### Result
|
||||
Directed to a web page
|
||||
|
||||
|
||||
#### My Work and Result
|
||||
```
|
||||
Magdel@LAPTOP-NS5FVUS9 MINGW64 ~/cloned-repo (main)
|
||||
$ git pull origin main
|
||||
remote: Enumerating objects: 5, done.
|
||||
remote: Counting objects: 100% (5/5), done.
|
||||
remote: Compressing objects: 100% (3/3), done.
|
||||
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0)
|
||||
Unpacking objects: 100% (3/3), 830 bytes | 138.00 KiB/s, done.
|
||||
From https://git.comorin.co/Git-Training-Hub/git-practice-Mag
|
||||
* branch main -> FETCH_HEAD
|
||||
e6d6844..0d3a053 main -> origin/main
|
||||
Updating e6d6844..0d3a053
|
||||
Fast-forward
|
||||
GIT_ASSIGNMENT.md | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 61 insertions(+)
|
||||
```
|
||||
|
||||
|
||||
# 11. Ignoring Files with .gitignore
|
||||
|
||||
Assignment:
|
||||
|
||||
In your repo, create a file secret.txt.
|
||||
|
||||
Create .gitignore and add:
|
||||
|
||||
secret.txt
|
||||
|
||||
Run git status → confirm secret.txt is ignored.
|
||||
|
||||
Commit the .gitignore file.
|
||||
|
||||
### My work
|
||||
```
|
||||
echo > secret.txt
|
||||
touch .gitignore
|
||||
echo "secret.txt" >> .gitignore
|
||||
|
||||
git status
|
||||
```
|
||||
|
||||
#### My result
|
||||
```
|
||||
$ git status
|
||||
On branch main
|
||||
Your branch is up to date with 'origin/main'.
|
||||
|
||||
Untracked files:
|
||||
(use "git add <file>..." to include in what will be committed)
|
||||
.gitignore
|
||||
|
||||
nothing added to commit but untracked files present (use "git add" to track)
|
||||
```
|
||||
|
||||
### My Work
|
||||
```
|
||||
git add .gitignore
|
||||
git commit -m "To ignore secret.txt"
|
||||
```
|
||||
|
||||
#### My Result
|
||||
```
|
||||
Magdel@LAPTOP-NS5FVUS9 MINGW64 ~/cloned-repo (main)
|
||||
$ git add .gitignore
|
||||
warning: in the working copy of '.gitignore', LF will be replaced by CRLF the next time Git touches it
|
||||
|
||||
Magdel@LAPTOP-NS5FVUS9 MINGW64 ~/cloned-repo (main)
|
||||
$ git commit -m "To ignore secret.txt"
|
||||
[main e67a990] To ignore secret.txt
|
||||
1 file changed, 1 insertion(+)
|
||||
create mode 100644 .gitignore
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user