mirror of
https://github.com/lemeow125/Notes.git
synced 2024-11-17 04:09:26 +08:00
vault backup: 2024-11-06 23:57:58
Affected files: docs/Command Snippets/Command Snippets.md docs/Command Snippets/Git Snippets.md
This commit is contained in:
parent
b058b2d155
commit
f7d60ada76
2 changed files with 34 additions and 1 deletions
|
@ -3,4 +3,5 @@
|
|||
- [Bash Commands](Bash%20Commands.md)
|
||||
- [Docker - Miscellaneous](Docker%20-%20Miscellaneous.md)
|
||||
- [Docker Run](Docker%20Run.md)
|
||||
- [Windows Snippets](Windows%20Snippets.md)
|
||||
- [Windows Snippets](Windows%20Snippets.md)
|
||||
- [Git Snippets](Git%20Snippets.md)
|
32
docs/Command Snippets/Git Snippets.md
Normal file
32
docs/Command Snippets/Git Snippets.md
Normal file
|
@ -0,0 +1,32 @@
|
|||
|
||||
### Starter Cheat Sheet
|
||||
|
||||
Set up your identity with Git
|
||||
`git config --global user.name "YOUR_NAME_HERE`
|
||||
`git config --global user.email "YOUR_EMAIL@MAIL.COM`
|
||||
|
||||
Initialize repository
|
||||
`git init .` or just plain `git init`
|
||||
|
||||
Make your first commit
|
||||
`git add .`
|
||||
`git status` to check the staged files
|
||||
`git commit -m "Initial commit"` for your first commit
|
||||
|
||||
Add remote repository (we just call it "remote")
|
||||
`git remote add origin https://github.com/user/repository.git` where
|
||||
- `origin` is the name of your remote
|
||||
- and `https://github.com/user/repository.git` is the URL of your remote
|
||||
|
||||
Push to the repository
|
||||
`git branch -M main`
|
||||
- Sets the main/primary branch of Git to `main`
|
||||
If your repository is still empty
|
||||
`git push origin main --force`
|
||||
|
||||
If your repository is not empty (like working with other people for example)
|
||||
`git pull origin main`
|
||||
- You pull the changes from GitHub to your local copy
|
||||
`git push origin main`
|
||||
- You then push what you've worked on to GitHub for others to see
|
||||
|
Loading…
Reference in a new issue