Hello cousins and cousins, how are you?
Come check out these quick git command tips.
I believe you should use some of these commands every day.
- git init This is the command used to initialize a project as a git repository.
- git remote add origin This is the command used to add or connect to a remote repository.
- git remote This is the command used to view connected remote repositories.
- git status This command is used to view the status of files in your local repository.
- git add This command is used to prepare modified or untracked files.
- git reset This command is used to remove files.
- git commit This command is used to commit tested files and provide a confirmation message after testing.
- git push -u origin This command is used to push committed files to the GitHub repository.
- git fetch This command is used to fetch the most up-to-date version from your local repository. It checks for new files or new branches.
- git pull This command is used to take the information you just fetched and pull it into your local repository. It updates your local repository to the most up-to-date version.
- git branch This command is used to view the branch you are currently on.
- git merge This command is used to merge two branches. To do this, enter the branch you want to inherit the changes from.
Which of these commands do you use the most in your daily life, and if you felt high from any command, leave it in the comments.
Top comments (7)
I would add
git add -p
to this list. You can add your changes in parts (in case there are parts you do not wish to commit. Also,-p
works with all sorts of other git commands.git rebase
is another critical command, but it is more advanced.great article for beginners! i would like to add the
git reflog
which does the opposite ofgit reset
. know more about it here.Nice post, I would add
git stash
which save your changes in a stash list (this command saves your local modifications away and reverts the working directory to match the HEAD commit) and then you can recover it usinggit stash pop
Personally I use the git cli as little as possible.
When I do use it, the only command I do remember is
See tldr.sh/
Lol, tldr looks neat.
It would have been more readable if you had bold the commands, or kept them in double quotes. Like this.
The git command I use the most in my daily life: git clone 😅
Good for Beginners 👍