Git Commands L -> R
Type the following command to create a new directory for your repository:
mkdir my-new-repo
Change into the new directory:
cd my-new-repo
Initialize Git
git init
Now that your local repository has been created, you can add files, make changes, and commit them using Git. Once you have made some changes and committed them, you can push the changes to a remote repository.
git add
Add files to the staging area using the "git add" command. For example, to add all files in the current directory to the staging area, type:
git add .
git status
Display a summary of the current state of your repository, including any changes that have been made but not yet committed, any changes that have been staged for commit, and any untracked files.
git status
git commit
After making changes to your files and staging them with git add
, you can commit your changes using the following command:
git commit -m "Updated file1.txt and file2.txt"
git remote add origin
command to add a remote repository named "origin"
git remote add origin <remote-repository-URL>git
git push
Push the changes to the remote repository using the "git push" command
git push origin main
git log
This command will display a list of all the commits in your repository, starting with the most recent commit
git log
Last updated