_Git is a distributed version control system that tracks changes in any set of computer files._ Git is often used to update GitHub projects from the machine to the server by specific codes.
Write on Visual Studio Code.
toolbar --> Terminal --> New Terminal
(or just Ctrl + Shift + '
)PS C:\Users\you>
will apear on terminal. Use the command cd [path to project folder]
, like cd C:\Users\you\Projects
Write on Command Prompt.
Window Icon + R
and write cmd. Or search âCommand Promptâ on Window search bar.C:\Users\you>
will apear on terminal. Use the command cd [path to project folder]
, like cd C:\Users\you\Projects
Create the repository
The repositoty needs to be empty, without any file, even the README.md. Just donât select the checkbox âAdd a README fileâ when you create the repository. Itâs possible to do it in a full repository, but weâll not focus on that at the moment.
git init
git add .
git commit -m "a message"
git init
will create a file named as â.gitâ on your project folder.git add .
add your changes to your next commit.git commit -m 'a message'
Captures a snapshot of your project. Now you can push it to your GitHub repository.Then write the three commands that appear on your repository. They look like this:
git remote add origin https://github.com/YourGitHubUsername/repositoryName.git
git branch -M main
git push -u origin main
This creates a connection with your GitHub project and send the commit to your repository. You just need to use these three commands once.
You already has your repository up to date! đTo update again:
git add .
git commit -m "message"
git push origin main
Just this!
Your repository was changed by a collaborator, how to update your LOCAL CODE
git fetch
git pull
Creates a connection to the GitHub server and changes your code to match your project.
Now you can use the basics Git commands!