Hey! I am Rachit. I first learned about it from Reynald Adolphe, who succinctly covered the fundamentals in under 7 minutes on.
If you prefer following a step-by-step guide, you're in luck. I've crafted four straightforward steps based on my learning experience.
I personally use both methods to keep my skills sharp, though I find Git integrated with Visual Studio Code to be more intuitive. Ultimately, the choice between methods boils down to personal preference, and either option is perfectly fine!
- Visual Studio Code Version: 1.95.1 --> Download Reference
git --version
: git version 2.39.5 (Apple Git-154) --> Installation Reference
- Open Visual Studio Code.
- Open your project folder.
- Alternatively, you can navigate to your project folder in the terminal and use the command
code .
to open it in Visual Studio Code.
- Alternatively, you can navigate to your project folder in the terminal and use the command
- Click on the Source Control icon in the Activity Bar on the side (or press
Ctrl + Shift + G
). - Select "Initialize Repository".
- Alternatively, in the terminal, you can navigate to your project folder and use the command
git init
to initialize the repository.
- Alternatively, in the terminal, you can navigate to your project folder and use the command
- Make changes to your files in the project folder.
- In the Source Control panel, you'll see a list of changes. Click the
+
button next to each file you want to include in the commit to stage them.- Alternatively, in the terminal, you can use the command
git add .
to stage all changes. - Or use
git add file1.py main.tf
to stage specific files.
- Alternatively, in the terminal, you can use the command
- Enter a commit message in the text box at the top of the Source Control panel.
- Click the checkmark icon to commit the changes.
- Alternatively, in the terminal, you can use the command
git commit -m "Your commit message"
to commit the changes.
- Alternatively, in the terminal, you can use the command
- Click on "Publish Branch" icon (it looks like a cloud with an up arrow).
- You'll see options to select either "Public" or "Private" for your repository. Select your preferece. (This steps actually creates a blank repository to your GitHub Account)
- Alternatively, in the terminal, you can use the command
git remote add origin <repository-url>
to add a remote repository. - If prompted, sign in to your GitHub account.
- Fill in the repository name, description, and other settings as desired.
- Alternatively, in the terminal, you can use the command
- Pubishing Brach is completed here.
- Alternatively, in the terminal, you can use the command
git push -u origin master
to push the code to GitHub.
- Alternatively, in the terminal, you can use the command
- Click
Open on GitHub
notification prompt from left bottom of your screen. On your web browser and navigate to GitHub. - Sign in to your GitHub account.
- Navigate to your repository.
- You should see your project files and commit history in the repository.
If you wish to Uninitialize the repository
, follow below:
- Open the folder you wish to, in the Visual Studio Code
- Open
bash
terminal- selecting
bash
is important as we will use bash command
- selecting
- Run
pwd
to check the current location. This is because step 5.rm -rf
can never be undone. - Run
git status
- Run
rm -rf .git
If some files got accidentally synced to GitHub from Step 2, refer steps to revert here