Skip to content

Commit

Permalink
content: git changes / additions
Browse files Browse the repository at this point in the history
  • Loading branch information
daniele-salvagni committed Jul 12, 2024
1 parent 8095bbd commit 362ab64
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/content/notes/git.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ git config --global help.autocorrect 1

```bash
git remote add <alias> <url> # add git URL as an alias
git remote show <alias> # show information about remote
git fetch <alias> # fetch down all the **branches** from that remote
git merge <alias>/<branch> # merge a remote branch into current branch
git merge --abort # abort the merge
git push <alias> <branch> # transmit local branch to remote repository
git pull # fetch and merge any commits from remote
```
Expand All @@ -45,7 +47,7 @@ it in the working directory
git rm --cached <file>
```

### Listing branches
### Branches

```bash
git branch # local branches
Expand All @@ -54,6 +56,13 @@ git branch -a # all branches
git branch -av # all branches with details
```

```bash
git checkout -b <branch> # create and switch to a new branch
git checkout - # switch to the last branch
git branch -d <branch> # delete a branch
git switch <branch> # switch to a branch, look for remote
```

### Tagging

```bash
Expand All @@ -77,6 +86,16 @@ Clear staging area, rewrite working tree from specified commit

```bash
git reset --hard <commit>
git clean -df # to remove untracked files
```

Amend the last commit

```bash
git commit --amend -m "New commit message"

git add forgotten_file
git commit --amend --no-edit
```

## Advanced commands
Expand Down

0 comments on commit 362ab64

Please sign in to comment.