gist-git
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| gist-git [February 06, 2026 at 02:15] – yanevskiv | gist-git [May 14, 2026 at 11:38] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | # Git (Examples) | ||
| + | ## Basics | ||
| + | |||
| + | Creating a repository with an initial commit: | ||
| + | ``` | ||
| + | git init | ||
| + | ``` | ||
| + | |||
| + | Adding a file to the staging area: | ||
| + | ``` | ||
| + | git add file.txt | ||
| + | ``` | ||
| + | |||
| + | Un-adding a file from the staging area: | ||
| + | ``` | ||
| + | git restore --staged file.txt | ||
| + | ``` | ||
| + | |||
| + | Showing what's in the staging area: | ||
| + | ``` | ||
| + | git status | ||
| + | ``` | ||
| + | |||
| + | Creating a commit: | ||
| + | ``` | ||
| + | git commit -m 'add: feature' | ||
| + | ``` | ||
| + | |||
| + | ## Stashing | ||
| + | Stashing changes in the staging area: | ||
| + | ``` | ||
| + | git stash | ||
| + | ``` | ||
| + | Restoring stashed changes: | ||
| + | ``` | ||
| + | git stash pop | ||
| + | ``` | ||
| + | Giving up on stashed changes (dropping them): | ||
| + | ``` | ||
| + | git stash drop | ||
| + | ``` | ||
