Setting Up Git For Your Project Part 4

Working with Repository

Step 1: Create repo in github.

  1. Click on “+” top right corner and get nice menu options
  2. Click on New repository
  3. Enter repo name and click create repository button.

git117.png

Step 2: Navigate to your new repo.

Step 3: Click on Clone or download button and copy the URL of repo.

git118.png

Step 4: Open git bash

Step 5: navigate where you want to put your all code in your folder structure by using “cd” command.

Step 6: Use command  git clone to get the repo in your local machine.

git clone <you copied repo URL>

git119.png

Step 7: now navigate to repo and work locally add/ update files as you want.

git120.png

Step 8: use command to check the status, it will show all new/updated/deleted filed or we can say it shows all changes in the repo

git status

git121

Step 9:add all the modified/new files for commit

git add .

it will add all changes .

if you want to add specific file then append command with file name.

git add test.txt

git122.png

Step 10:Now our all changes are added ,now we need to commit and then push these to the remote repo.

git commit -m “comment for this commit”

git push origin <branch name>

git123

git124

git125.png

 

Now you can verify your changes on your git hub repo .

As we are working directly on master branch the file is available on master branch. Ideally we create new branch for a functionality do our all work in that branch and push it to git hub, then reviewer review it and merge it. we will look for this in next post.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s