Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/matheusmartinsviana/github-commands

This repository contains the basic commands to control remote/local repositories. 🐱‍👤
https://github.com/matheusmartinsviana/github-commands

gitcommands

Last synced: 12 days ago
JSON representation

This repository contains the basic commands to control remote/local repositories. 🐱‍👤

Awesome Lists containing this project

README

        

# Github Commands
This repository contains the basic commands to config your pc and how to use some commands on remote/local branchs. 🐱‍👤

###

# Github Commands

## Initial Config
```bash
git config --global user.email "[email protected]"
git config --global user.name "username"
```
## SSH Config (use Git bash)

Verify if exists a key
```bash
ls -al ~/.ssh
```

Add a new key
```bash
ssh-keygen -t ed25519 -C "[email protected]"
```

Initialize the agent
```bash
eval "$(ssh-agent -s)"
```

Add ssh key to agent
```bash
ssh-add ~/.ssh/id_ed25519
```

Copy the ssh key
```bash
clip < ~/.ssh/id_ed25519.pub
```

Add this key in Github
```bash
Github -> Settings -> SSH and GPG keys -> New SSH key -> Past the key
Use a good title to you remember
```

Conection Test
```bash
ssh -T [email protected] -> yes
```

###

# Git Commands

Initialize a new repository in a new folder
```bash
git init
```

Show the current state from repository
```bash
git status
```

Add the modified file to the index (staging area)
```bash
git add
```

Remove all files from index (staging area)
```bash
git rm --cached / git restore --staged
```

List all local branchs that exists
```bash
git branch
```

List all remote branchs
```bash
git branch -r
```

List all local/remote branchs
```bash
git branch -a
```

Move to a specific branch
```bash
git checkout
```

Create a new branch and enter on this branch
```bash
git checkout -b
```

Delete a branch
```bash
git branch -D
```

Create a commit with all modifications in the index with a message
```bash
git commit -m ""
```

Discard the last commit keeping the changes in the index
```bash
git reset --soft HEAD~1
```

Send commits from local repository to remote repository
```bash
git push
```

Update the local repository with informations from remote repository
```bash
git fetch
```

Update the local repository with news updates from remote branch
```bash
git pull
```