You are on page 1of 7

Git and GitHub:

Case-I:

Viraj Local Machine:

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

User: virajvelocity@gmail.com
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 "virajvelocity@gmail.com"

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