In this tutorial, How to use the git command every day. Git cheat sheet I use every day.
What does Git mean?
Git is software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Quote from Wikipedia.
Git Cheat Sheet example
Check my git configure
git config -l
Setup my Git username and Email Id
git config --global user.name "HuuPV"
git config --global user.email "HuuPV@devopsroles.com"
Username and EmailID assigned to commit from local computer.
Initialize an empty Git repo
Add a file to the staging area in Git
git add file_name
Add all files in your project to the staging area in Git
git add .
Commit changes for the files in a local repo.
git commit -m "first commit"
shows the commit history for the current repository
Show if a file is in the staging area, but not committed
Remove tracked files from the current working tree
git rm filename
git mv oldfile newfile
Create a new branch
git branch branch_name
Switch to a newly created branch
git checkout branch_name
Create a new branch and switch it immediately
git checkout -b branch_name
Merge two branches
git merge branch_name
Add a remote repository to your local repository
git add remote https://repo_url_here
download updates from a remote repository.
After committing your changes, the next you send changes to the remote server.
git push #or force push git push -f
You have used Git Cheat Sheet every day. I hope will this your helpful. Thank you for reading the DevopsRoles page!