Day-07 Git-Terraform-Jira
Git commands:
git init : git init
is a command used to initialize a new Git repository. When you run this command in a project directory, it creates a hidden .git
folder, which is where Git stores all the information about the repository, including its history, configuration, and branches.
git status: git status
is a command that shows the current state of your working directory and staging area in a Git repository. It helps you see which files are being tracked, which files have changes, and what is ready to be committed.
git add . : git add .
is a Git command used to stage all the changes in the current directory and its subdirectories for the next commit. This includes new files, modified files, and deleted files.
git commit -m: git commit -m
is a Git command used to save changes to the repository with a message describing what was changed. The -m
flag allows you to include a commit message directly in the command without opening a text editor.
git log: git log
is a Git command used to display the commit history of the repository. It shows a list of all the previous commits, including important details such as the commit hash, author, date, and the commit message.
git log — oneline : git log --oneline
is a Git command that shows the commit history in a simplified, compact format. Each commit is displayed as a single line, showing the commit hash and the commit message. This is especially useful for quickly reviewing the commit history without detailed information like the author or date.
git remote -v: git remote -v
is a command used to display the list of remote repositories associated with your local Git repository. It shows the names of the remote repositories and their URLs, indicating where your code is pushed and pulled from.
git remote add origin: git remote add origin
is a command used in Git to link your local repository to a remote repository. This is often done when you first create a project and want to push it to a platform like GitHub, GitLab, or Bitbucket.
git branch: The git branch
command is used in Git to manage branches in your project. Branches allow you to work on different features or fixes independently without affecting the main codebase.
git branch -m main feature: The command git branch -m master development
is used to rename an existing branch in Git.
git push origin feature: The command git push origin development
is used in Git to push your local development
branch to the remote repository named origin
.
git checkout -b development: The command git checkout -b production
is used in Git to create a new branch called production
and switch to it immediately.
git push origin development: The command git push origin production
is used in Git to push your local production
branch to the remote repository named origin
.
git checkout feature: The command git checkout development
is used in Git to switch your current working branch to the development
branch.