From f7d60ada76b5ed2fa496bf9b1dc594e6a5c9bcd7 Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Wed, 6 Nov 2024 23:57:59 +0800 Subject: [PATCH] vault backup: 2024-11-06 23:57:58 Affected files: docs/Command Snippets/Command Snippets.md docs/Command Snippets/Git Snippets.md --- docs/Command Snippets/Command Snippets.md | 3 ++- docs/Command Snippets/Git Snippets.md | 32 +++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 docs/Command Snippets/Git Snippets.md diff --git a/docs/Command Snippets/Command Snippets.md b/docs/Command Snippets/Command Snippets.md index e7fd9e0..84f7b9c 100644 --- a/docs/Command Snippets/Command Snippets.md +++ b/docs/Command Snippets/Command Snippets.md @@ -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) \ No newline at end of file +- [Windows Snippets](Windows%20Snippets.md) +- [Git Snippets](Git%20Snippets.md) \ No newline at end of file diff --git a/docs/Command Snippets/Git Snippets.md b/docs/Command Snippets/Git Snippets.md new file mode 100644 index 0000000..c2c6155 --- /dev/null +++ b/docs/Command Snippets/Git Snippets.md @@ -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 +