Loading, please wait...

MCQ

The 10 Most Used Git Commands

May 09, 2020 Git, GitHub, Git Commands, Repos, 3886 Views
If you use Git repos, this article will make you more comfortable with Git.

Before this Article read the my previous article:

What is Git? | Git Tips and Tricks

πŸ‘‰πŸΌ git init

We use git init to initialize a new Git repository. Lets Git know it should start tracking all changes that in the repo.

πŸ‘‰πŸΌ git status

Logs the current state of our repository. It lets us see which changes have been staged, which haven't, and lets us know if there are any files that aren't being tracked by Git.

πŸ‘‰πŸΌ git add

used to stage our new files or to stage our new changes. This is how we'll let Git know we have a change we want to save and it should add it to our current version.

πŸ‘‰πŸΌ git commit

git commit is used to add all files that are staged to our local repository. It's like taking a snapshot of our repo (repository) at a certain point in time that we will later upload (push) into our remote repository.

πŸ‘‰πŸΌ git diff

A very useful command that allows us to see what has changed in our repo since our last commit.

πŸ‘‰πŸΌ git clone

Used to clone an existing remote repository and create a clone in your local environment. SO USEFUL!!!

πŸ‘‰πŸΌ git checkout

We can use this command to look at a prior state of the repository or to look at a different branch.

πŸ‘‰πŸΌ git pull

when we use this command we fetch and "download" whatever is in our remote branch into our local branch. It will update our local branch to match our remote branch.⁣

πŸ‘‰πŸΌ git merge

Merging takes the contents of a source branch and integrates them with our target branch. It's good to note only the target branch is changed and the source branch history remains the same.

πŸ‘‰πŸΌ git push

The command that will get our local files into our remote repository. In the remote repository, all files and changes will be available to anyone who has access to the repo. ⁣ ⁣
β €β €β €β €β €β €β €β €β € ⁣ ⁣
πŸ’¬ Should we talk about GUIs next? I want to hear your thoughts in the comment section belowπŸ‘‡πŸΌπŸ‘‡πŸΌ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣

MCQ

Related Article