Day 10.Git Commands for DevOps
Git Commands
git init - Initializes a new git repository in current directory
git initgit config --global user.name "Your Name"
git config --global user.email "Your Email" - Sets user name and email for git
git config --global user.name "Your Name"
git config --global user.email "Your Email"git clone - This command allows you to create a local copy of a remote repository. It downloads the entire repository, including all branches and commit history.
git clone https://github.com/example/repository.gitgit remote -v - used to check all the remotes associated with local repository.
git remote -vgit add - adds files to staging area
git add <filename>git commit - saving the changes made to the files in the staging area. It's essential to provide a descriptive commit message to document the changes
git commit -m "This is first commit"Local repositories reside on the computers of team members. In contrast, remote repositories are hosted on a server that is accessible for all team members — most likely on the internet or on a local network.
Get Ashiimahajan’s stories in your inbox
Join Medium for free to get updates from this writer.
git remote add origin <Http Url> - connects local repository with remote repository.
git remote add origin <Http Url>git push -u origin main - We push changes from local repository to origin main.
git push -u origin maingit pull - fetches changes from remote repository.
git pull origin maingit status = Used to show status of reposiroty.
git statusgit branch - It is used to create , delete or list branches
git branch feature-branch
git branch -d feature-branch
git branchgit checkout - used to switch between branches.
git checkout feature-branchgit merge - merge changes from different branch
git merge feature-branchgit log - show history of commits
git loggit rm <file> - removes file from staging area
git rm <file>git diff - git diff returns the list of all the delta changes introduced in various files in our working directory between HEAD and the current index including untracked files.
git diffgit mv - Used to move a file
git mv <file>






