git_push_pull
git_push_pull
EMP ID : 13076
COMMANDS
What is Git?
Git is a version control system for tracking changes in
computer files. It is used for coordinating work among
several people on a project and tracking progress over time.
Someone else’s work isn’t available for all and branched from master branch
Step 1 :
Open Git Bash and check the default directory of Git bash on
your local machine by typing below command in Git bash.
COMMAND : pwd
Step 2 :
We can make a folder containing all the files manually in a
directory or by using the command.
COMMAND : mkdir MyFiles
Step 3 :
COMMAND : cd MyFiles
(cd – Change Directory)
Step 4 :
We will initialize Git command for our folder using the
command.
COMMAND : git init
(init – initialize)
Step 7 :
To add the untracked files we use the following command.
COMMAND : git add .
(NOTE : After git add there is a space and then a fullstop (.) )
After executing Add command repeat Step 6 to see the status
of the untracked files. You will see the files are now tracked
in green colour in git bash console.
Step 8 :
To commit the changes we use the following command.
COMMAND : git commit –m “Added first text file”
Step 10 :
Pushing the files into the repository
Step 11 :
Go to your Git repository and refresh
(If in case after pushing in Step 10 it prompts to login with
browser. Login with your Git Account for verification and
authorize the Git dependency then refresh)
Step 1 :
Open Git Bash and check the default directory of Git bash on
your local machine by typing below command in Git bash.
COMMAND : pwd
Step 2 :
We can make a folder containing all the files manually in a
directory or by using the command.
COMMAND : mkdir MyGitFiles
Step 3 :
Now we need to go inside the folder we created we can do
that using the command and check directory by following
command.
COMMAND : cd MyFiles
(cd – Change Directory)
Step 4 :
We will initialize Git command for our folder using the
command.
COMMAND : git init
(init – initialize)
Step 5 :
We will go to the repository from where we need to pull the
files for this we go to our GitHub repository Click on code and
copy the HTTPS link.
Step 6 :
Now we will pull the contents of git repository in our folder
(i.e “MyGitFiles”) to pull use the following command.
COMMAND : git pull
https://github.com/nidishnrao/MyFirstRepository.git
In MyGitFiles folder now you will find the text file
which was present in repository
Step 1 :
Step 2 :
Now we will add a new file either manually by copying the
files into the folder directly or by using the git bash
command.
COMMAND : touch MySecondText.txt
COMMAND : notepad MySecondText.txt
Add some content in the new text file created and save it.
Now will find 2 text files under MyGitFiles folder.
In which “MyFirstText” file is the modified one & the
“MySecondText” file is the new file created.
Step 3 :
Now, Check the status of the files present / added in this
folder by using the command.
COMMAND : git status
Step 5 :
To commit the changes we use the following command.
COMMAND : git commit –m “Added Second text file and
modified the first text file”
Step 7 :
Pushing the files into the repository
Step 8 :
Go to your Git repository and refresh
(If in case after pushing in Step 7 it prompts to login with
browser. Login with your Git Account for verification and
authorize the Git dependency then refresh)