0% found this document useful (0 votes)
190 views7 pages

Git and GitHub

This document discusses using Git and GitHub to collaborate on code development. It provides steps to: 1. Create a GitHub account and repository to host code. 2. Install Git locally and initialize a repository. 3. Clone the GitHub repository, make changes locally, commit changes, and push updates to GitHub. 4. Another developer imports the project from the shared GitHub repository, makes local changes, and pushes updates.

Uploaded by

sandip bhosale
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)
190 views7 pages

Git and GitHub

This document discusses using Git and GitHub to collaborate on code development. It provides steps to: 1. Create a GitHub account and repository to host code. 2. Install Git locally and initialize a repository. 3. Clone the GitHub repository, make changes locally, commit changes, and push updates to GitHub. 4. Another developer imports the project from the shared GitHub repository, makes local changes, and pushes updates.

Uploaded by

sandip bhosale
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/ 7

Git and GitHub:

Case-I:

Viraj Local Machine:

1. Create an account at GitHub, where we can host our code

User: [email protected]
Password: Velocity@8888

2. Create a new GitHub repository say 'Test23'

a) Click New Button

b) Enter Repository Name


c) Click Create Repository

3. Download git and install


a) Search git
b) Click 1st option Git

c) Click Download for Windows


d) Install git

5) Create a local folder in your System for Git repository and Navigate to this folder
using command prompt

6) git init: Initialize the git folder as Local git repository(V_Local) (.git folder will be
created)

7) Register yourself with Git:


i) git config --global user.name "Viraj"
ii) git config --global user.email "[email protected]"

8) git clone https://github.com/virajvelocity/Test23.git : Clone the GitHub


repository(Test23) to the local repository(V_Local)

9) cd Test23 : Go inside the cloned project folder(i.e Test23)

10) Go to Eclipse and Copy all the Project files and Paste it to the Test23(Local
repository Folder)

11) We have to commit before pushing the code to GitHub


i) There are two levels of commit
a) git add * : staging and commit (Adding all the project files to staging)

ii) Commiting the code


b) git commit -m "first commit":

12) git remote add origin https://github.com/virajvelocity/Test23.git :(Copy this


Command from GitHub Repository-->We can find this command ready for us in the
GitHub page) Giving the address of GitHub where we need to push the local
repository code
13) git push -u origin main :(Copy this Command from GitHub Repository-->We
can find this command ready for us in the GitHub page) Push the code to GitHub
Case-II:
Santosh Local Machine:

Import this code into Eclipse IDE:

1) Launch Eclipse IDE and Import the Project from GitLocalRepo


2) Do some changes to the LocalRepo code Check the changes, add to staging and
commit

a) cd Test23 : Go inside the cloned project folder(i.e Test23)


b) git status : Check Update file status
c) git add* or git add src/test/java/tests/TestFour.java/ : taging and commit (Adding
all the project files to staging)
d) git commit -m "second commit comment" :Commiting the code
d) git status : Check Update file status
e) git push -u origin main : Code is pushed to the branch

You might also like