Language support:
- As you can see, the translations were done instantly, if there are any errors, please disregard the act
- If you like the content, share it
GitHub has a large repertoire of usable commands, which separately perform different functions.
This repo will not introduce you to basic concepts about GitHub, it will just show you, some of the most used GitHub commands.
All commands visible in here, will be representing a function. Whether it's making a small commit or helping you handle branches.
To make a commit there are a few steps.
First you must check if your repository has already been created on your GitHub.
It will already help you to do it, giving the first steps when creating a repo, however, here is a brief explanation of what each one does and represents.
git init
git add README.md
Making your commit with a message of your choice (it is worth remembering, that message will be displayed).
git commit -m "first commit"
This command will help you to establish the necessary connection to upload your changes, note that this command synchronizes your local project with the repo present in your Git.
git remote add origin https://github.com/YourUserName/YourRepoName.git
git branch -M main
Do the push (as the name implies, push is the act of pulling the local content, synchronized with your repo).
git push -u origin main
Did you saw? It's not that difficult to commit and push in a repo, following these steps exactly, after creating a repo in your profile, you will upload all the available content to your GitHub! It is important to remember that this is just the initial step, throughout a project, you will update it more often, and it is not necessary to repeat the process, just issue the following commands, and your new version will be available:
git add .
git commit -m "update version"
git push
Here are some of the commands needed to view and manipulate branches and remote repositories:
1- git remote show origin
2- git remote rename origin curso-git
3 -git remote rm curso-git
4- git remote -v
5- git branch
6- git checkout branchName
7- git checkout master
8- git merge branchName
9- git branch -a
10- git checkout -b NewBranch
Respectively, they:
- 1- Show the linked origin
- 2- Rename the linked origin
- 3- Remove the link to your repository
- 4- Show all linked origins
- 5- Display the branch you are manipulating
- 6- Select a branch of your choice
- 7- Return to the main branch
- 8- Merge your different branches
- 9- View all branches (both remote and local)
- 10- Create a new branch with the name of your choice
git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
You may at a given moment, want to change files present in your project, instead of looking for and changing it manually, you can:
1- git status
2- git add file.txt
3- git rm file.txt
4- git rm directory
Respectively, the commands:
- 1- Show the stats of your files in your directory
- 2- Add a file
- 3- Remove a file
- 4- Remove a directory
Right now, if you know a little about git commands, you might be wondering why there is a single and exclusive session for the git pull command. The answer is simple, the git pull command is not just a single command that executes an "any" function, it is perhaps the most used command after its brothers commit and push, not to mention the countless variations and complements it has. So hold on, and let's do it!
What is the git pull command?
The git pull command is used to search and download content from remote repositories and immediately update the local repository so that the contents are the same, thus not having, difference between the contents to be merged, without risk of errors or bugs.
In the first stage of the operation, git pull executes the git fetch command, which covers the local branch to which the HEAD points.
When the content is downloaded, git pull enters the merge workflow. The merge commit is created and the HEAD is updated to point to the new commit.
git pull
1- git config --global user.email YourEmail
2- git config --global user.name "Your name"
3- git config --global core.excludesfile ~/.gitignore
4- git help
Respectively, the commands:
- 1- Configures the user's global email (required during the git install process)
- 2- Configures the user's global name (required during the git install process)
- 3- Files to be ignored
- 4- The Git help