Monday, January 19, 2015

Make a sync with eclipse project and Github

First create a repo in github. Name will be like "BuilderPattern"

rizvi@rizvi-HP:~/workspace/BuilderPattern$ git init
Initialized empty Git repository in /home/rizvi/workspace/BuilderPattern/.git/

rizvi@rizvi-HP:~/workspace/BuilderPattern$ git remote add origin 
https://github.com/rizvi/BuilderPattern.git

rizvi@rizvi-HP:~/workspace/BuilderPattern$ ls
rizvi@rizvi-HP:~/workspace/BuilderPattern$ ls -lah
total 12K
drwxrwxr-x  3 rizvi rizvi 4.0K জুল    13 16:41 .
drwxrwxr-x 51 rizvi rizvi 4.0K জুল    13 16:19 ..
drwxrwxr-x  7 rizvi rizvi 4.0K জুল    13 16:43 .git

rizvi@rizvi-HP:~/workspace/BuilderPattern$ git fetch origin master
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From https://github.com/rizvi/BuilderPattern
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master

rizvi@rizvi-HP:~/workspace/BuilderPattern$ git branch -a
  remotes/origin/master

rizvi@rizvi-HP:~/workspace/BuilderPattern$ git checkout -b br#20170713 origin/master
Branch br#20170713 set up to track remote branch master from origin.
Switched to a new branch 'br#20170713'

rizvi@rizvi-HP:~/workspace/BuilderPattern$ git gui 
// Write a commit message and commit here.

rizvi@rizvi-HP:~/workspace/BuilderPattern$ git branch -a
* br#20170713
  remotes/origin/master

rizvi@rizvi-HP:~/workspace/BuilderPattern$ git push origin br#20170713:br#20170713
Username for 'https://github.com': rizvi
Password for 'https://rizvi@github.com': 
Counting objects: 14, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (14/14), 2.65 KiB | 0 bytes/s, done.
Total 14 (delta 0), reused 0 (delta 0)
To https://github.com/rizvi/BuilderPattern.git

 * [new branch]      br#20170713 -> br#20170713



In Github make a repository named by “JavaPro1

Make a Java Project in eclipse. Name is “JavaPro1”. Then open the command prompt and go to the location of the project of eclipse workspace.

rizvi@rizvi-pc:~/workspace/JavaPro1$ git init
Initialized empty Git repository in /home/rizvi/workspace/JavaPro1/.git/
rizvi@rizvi-pc:~/workspace/JavaPro1$ git add .
rizvi@rizvi-pc:~/workspace/JavaPro1$ git gui
rizvi@rizvi-pc:~/workspace/JavaPro1$ git remote add origin https://github.com/rizvi/JavaPro1.git
rizvi@rizvi-pc:~/workspace/JavaPro1$ git push -u origin master
Username for 'https://github.com': macPro
Password for 'https://macPro@github.com':
To https://github.com/macPro/JavaPro1.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.


rizvi@rizvi-pc:~/workspace/JavaPro1$ git branch -a
* master
remotes/origin/master
rizvi@rizvi-pc:~/workspace/JavaPro1$ git checkout -b br1001
Switched to a new branch 'br1001'
rizvi@rizvi-pc:~/workspace/JavaPro1$ cd src
rizvi@rizvi-pc:~/workspace/JavaPro1/src$ cd org/rizvi/
rizvi@rizvi-pc:~/workspace/JavaPro1/src/org/rizvi$ ls
Test.java
rizvi@rizvi-pc:~/workspace/JavaPro1/src/org/rizvi$ touch Test2.java
rizvi@rizvi-pc:~/workspace/JavaPro1/src/org/rizvi$ gedit Test2.java
rizvi@rizvi-pc:~/workspace/JavaPro1/src/org/rizvi$ git gui
rizvi@rizvi-pc:~/workspace/JavaPro1/src/org/rizvi$ git push origin br1001:br1001
Username for 'https://github.com': macPro
Password for 'https://macPro@github.com':
To https://github.com/macPro/JavaPro1.git

No comments:

Post a Comment