The 10 Most Used Git Commands
Before this Article read the my previous article:
👉🏼 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👇🏼👇🏼