Hello World from OSS Silicon Valley


HowToUse/Git/1.7

  • The added line is THIS COLOR.
  • The deleted line is THIS COLOR.
  • Go to HowToUse/Git/1.7.

#contents

*Install&Setup [#md5becfa]
**Install Git from Cygwin [#k4e04c5b]
(TBD)

**Configuration [#p822417b]
Step.1) Setup configuration as needed.

Example)

 $ git config --global color.ui true
 $ git config --global user.name "<User Name>"
 $ git config --global user.email "<Email address>"
 $ git config --global core.editor <Editor>
 $ git config --global alias.mylog "log --pretty=format:'%h %s [%an]' --graph"

Step.2) Setup .ignore as needed.

Example)

 logs/*.log

*HowToUse [#hd885861]
**General Operation [#q9061a8b]

:Step.1|
Clone the repository

 $ git clone <Remote Repository>

:Step.2|
Create a new branch.

 $ git checkout -b <Branch Name>

:Step.3|
Edit files.

:Step.4|
Stage updated files.

 $ git add .

You can reset the updated files.

 $ git reset HEAD

:Step.5|
Commit the files.

 $ git commit -m "<commit message>" 

If you are using GitHub, you can close the issue with the following commit message.

 $ git commit -m "Close #<issue no>"

:Step.6|
Merge the commited files into master.

 $ git checkout master
 $ git merge <Branch Name>

:Step.7|
Remove the branch.

 $ git branch -d <Branch Name>

:Step.8|
Push the files to remote server.

 $ git push


**Use original Git Server [#r8596e41]
***Setup the Git Server [#pcb92f91]
**Setup Repository server [#pcb92f91]
***Original Git Server [#r8596e41]
Refer [[HowToUse/Git Daemon/1.7]]

***Create Repository [#o328d5d8]
***GitHub [#i8b73466]
:Step.1|Access the GitHub web site and sign up(https://github.com/).
#ref(GitHub_fig1.png,,500x266,)
#ref(GitHub_fig2.png,,500x266,)

:Step.2|Click "create" button and create new repository.
#ref(GitHub_fig3.png,,500x266,)
#ref(GitHub_fig4.png,,500x266,)


***BitBucket [#n0e61de8]
:Step.1|Access the BitBucket web site and sign up(https://bitbucket.org/).
#ref(BitBucket_fig1.png,,500x266,)
#ref(BitBucket_fig2.png,,500x266,)

:Step.2|Click "create" button and create new repository.
#ref(BitBucket_fig3.png,,500x266,)
#ref(BitBucket_fig4.png,,500x266,)



**Create Repository [#o328d5d8]
***Original Git Server [#v031ee11]
:Step.1|Create your local repository.

 # mkdir <Local Repository>
 # cd <Local Repository>
 # git init
 # git remote add origin <User Name>@<Host name>:<Repository Path>

(Example)
 # git remote add origin syatsuzuka@192.168.56.101:/home/syatsuzuka/repo/test.git

:Step.2|Check in the first file.

 # touch readme.txt
 # git add readme.txt
 # git commit -m 'Initial commit'
 # git push -u origin master


**Use GitHub [#w505603b]
***Sign up the GitHub [#ha159fd9]
:Step.1|Access the GitHub web site and sign up(https://github.com/).
#ref(GitHub_fig1.png,,500x266,)
#ref(GitHub_fig2.png,,500x266,)

:Step.2|Click "create" button and create new repository.
#ref(GitHub_fig3.png,,500x266,)
#ref(GitHub_fig4.png,,500x266,)


***Create Repository [#eeb45dca]
***GitHub [#w505603b]
:Step.1|Create your local repository.

 # mkdir <Local Repository>
 # cd <Locak Repository>
 # git init
 # git remote add origin https://<User Name>@github.com/<User Name>/<Repository Name>.git

(Example)
 # git remote add origin https://github.com/syatsuzuka/test.git

:Step.2|Check in the first file.

 # touch readme.txt
 # git add readme.txt
 # git commit -m 'Initial commit'
 # git push -u origin master
#ref(GitHub_fig5.png,,500x266,)


**Use BitBucket [#j1eba035]
***Sign up the BitBucket [#n0e61de8]
:Step.1|Access the BitBucket web site and sign up(https://bitbucket.org/).
#ref(BitBucket_fig1.png,,500x266,)
#ref(BitBucket_fig2.png,,500x266,)

:Step.2|Click "create" button and create new repository.
#ref(BitBucket_fig3.png,,500x266,)
#ref(BitBucket_fig4.png,,500x266,)


***Create Repository [#fd616f93]
***BitBucket [#m2115638]
:Step.1|Create your local repository.

 # mkdir <Local Repository>
 # cd <Locak Repository>
 # git init
 # git remote add origin https://<User Name>@bitbucket.org/<User Name>/<Repository Name>.git

(Example)
 # git remote add origin https://syatsuzuka@bitbucket.org/syatsuzuka/test.git

:Step.2|Check in the first file.

 # touch readme.txt
 # git add readme.txt
 # git commit -m 'Initial commit'
 # git push -u origin master
#ref(BitBucket_fig5.png,,500x266,)


***Maintain the files in remote Repository [#ia5caee3]
**Maintain files [#va661c8e]
***Comand Line [#o747a64f]
:Step.1|Clone the existing repository to local

 $ git pull <Repository Path>

:Step.2|Edit and check in the files to local repository
 (edit files)
 $ git add .
 $ git commit -m '<message>'

:Step.3|Push the updated file to remote repository
 # git tag -a <version> -m '<description>'
 # git pull origin
 # git push origin

When you encounter "Fatal Error" to upload files to GitHub, you may be able to deal with the following operations.

 $ git remote set-url origin https://<your github account>@<your github repository path>

(Example)
 $ git remote set-url origin https://syatsuzuka@github.com/nasebanal/co-working.git

 $ unset SSH_ASKPASS
 $ git push origin



***Eclipse [#pd8cafe5]
:Step.1|Clone the remote repository.
 # git clone <Repository Path>

(Example)
 # git clone https://syatsuzuka@bitbucket.org/syatsuzuka/test.git

:Step.2|Launch Eclipse and switch to Git Perspective.
#ref(MaintainFiles_fig1.png,,500x266,)

:Step.3|Click "Add an existing local Git repository" and setup Local Repository Path.
#ref(MaintainFiles_fig2.png,,500x344,)
#ref(MaintainFiles_fig3.png,,500x266,)

:Step.4|Edit the files.

:Step.5|Commit and push the modified files.
Eclipse Plugin sometimes doesn't have full functionalities for the external utilities such as maven or git, so I recommend you to use command line for fundamental operations except for editing files.
 # git add <Modified Files>
 # git commit -m '<Commit Log>'
 # git tag -a <version> -m '<description>'
 # git pull origin
 # git push origin


**Further Operation [#z2d0b6d6]
**Other operations [#s86f627a]
***Maintain submodule [#n36c1f6e]
:Step.1|Get submodule in the workspace.
 # git submodule <repository path> <submodule directory>

Then you can include submodules to your project without maintaining version control for its submodule code.


*Author [#v4f30f2e]
S.Yatsuzuka