0% found this document useful (0 votes)
2 views2 pages

Git+Commands

This document outlines the basic Git workflow, starting from creating a local repository to pushing changes to a remote repository. It includes steps for initializing a repository, configuring user information, staging files, committing changes, connecting to a remote repository, and pushing code. Users are reminded to replace placeholders with their actual information during the process.

Uploaded by

naresh maddu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Git+Commands

This document outlines the basic Git workflow, starting from creating a local repository to pushing changes to a remote repository. It includes steps for initializing a repository, configuring user information, staging files, committing changes, connecting to a remote repository, and pushing code. Users are reminded to replace placeholders with their actual information during the process.

Uploaded by

naresh maddu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Git Commands

Git workflow from creating a local repository to pushing changes to a


remote repository.

1) Create a New Local Git Repository

To create a new local Git repository, navigate to the desired directory and
run git init:

git init

2) Provide User Info to Git Repo (One Time)

You need to configure your username and email for Git, which is usually
done once. Replace "your name" and "your email" with your actual name
and email:

git config --global user.name "your name"


git config --global user.email "your email"

3) Adding Files or Folders to Staging

To add files or folders to the staging area, use the git add command. You
can add specific files, all files, or files matching a certain pattern:

git add -A # Add all files and folders to staging


git add filename # Add a specific file to staging
git add *.java # Add all Java files to staging
git add foldername # Add all files within a folder to staging

4) Commit the Code into Local (Git) Repository

After adding files to the staging area, you commit them to the local
repository along with a commit message using git commit -m "commit
message":

git commit -m "commit message"

5) Connect Local Repository with Remote Repository (One


Time)

If you haven't already, you need to connect your local repository with a
remote repository. This is typically done using the git remote add command
followed by the remote repository URL:

git remote add origin "https://github.com/pavanoltraining/opencart.git"

6) Push the Code into Remote Repository

Finally, to push your committed changes from the local repository to the
remote repository, use the git push command followed by the name of the
remote repository (often origin) and the branch you want to push (often
master for the main branch):

git push origin master

These steps cover the basic Git workflow from creating a repository to
pushing changes to a remote repository. Remember to replace "your
name", "your email", and the repository URL with your actual information.

You might also like