Skip to content

Commit

Permalink
Homework 02.GIT.Local
Browse files Browse the repository at this point in the history
  • Loading branch information
Julie717 committed Dec 19, 2024
1 parent fac6068 commit 27920db
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
79 changes: 79 additions & 0 deletions Yuliya_Buyalskaya/02.Git.Local/02.GIT.Local.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
## Homework Assignment 1: Initializing a Local Repository
```shell
mkdir project
cd project
git init
git config --global init.defaultBranch master
echo "Homework Assignment 1: Initializing a Local Repository">>README.md
git add README.md
git commit -m "Create README"
```

## Homework Assignment 2: Basic Version Control
```shell
git checkout -b feature-branch
echo "Working with git locally">>README.md
git commit -a -m "Update README"
git checkout master
git merge feature-branch
```
## Homework Assignment 3: Exploring Git History
```shell
git log
git log --pretty=format:"%H | %ar | %s"
git log --graph --pretty=oneline
git log -p #show difference
git log --stat
git show ac35568980c7bf7334095a258f3bd54acbafe626
git show ac35568
```
## Homework Assignment 4: Creating and Applying Tags
```shell
git tag -a v1.0 ac35568980c7bf7334095a258f3bd54acbafe626 -m "Tag v1.0"
git tag #check that tag was created
echo "Working on tags">>README.md
git commit -a -m "Add current work to README"
git tag v2.0
git tag #check that tag was created
git show v1.0
git show v2.0
git for-each-ref refs/tags #show what tags are annotated and lightweight
```
## Homework Assignment 5: Undoing Changes
```shell
git checkout -b bug-fix
echo "Undoing Changes">>README.md
git commit -a -m "Change README"
date >> README.md
git commit -a -m "Add date to README"
git reset --soft HEAD~1
git status
git commit -m "Add date to README one more time"
git reset --mixed HEAD~1
git status
git commit -a -m "Add date to README. Last try"
git reset --hard HEAD~1
git status

```
## Homework Assignment 6: Stashing Changes
```shell
git checkout master
git checkout -b experimental-feature
hostname >> README.md
git stash
git stash list
git checkout bug-fix
git stash apply
nano README.md #resolving conflicts
git add .
git commit -m "Add hostname to README"
git status
```
## Homework Assignment 7: Git Aliases and Configuration
```shell
git config --global user.email "buyalskaya.yv@gmail.com"
git config --global user.name "Buyalskaya Yuliya"
git config --global alias.cm "commit -a -m" #create alias cm
git config --list
```
2 changes: 2 additions & 0 deletions Yuliya_Buyalskaya/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Project description
[Homework 02. GIT. Local](../Yuliya_Buyalskaya/02.Git.Local/02.GIT.Local.md)

0 comments on commit 27920db

Please sign in to comment.