Pages

2014-10-01

[Ubuntu12.04]Commit Code to GitHub


Before commit code to GitHub, you need to apply an account of GitHub.
Here's the link,  https://github.com/

1. #move to a directory that use to save source code
    #for example, /opt
    $ cd /opt

2. #download the Project/Source Code you want from GitHub
    #for example, chilung/OCP_CI_Server_Certification_Test_Cases
    $ git clone https://github.com/chilung/OCP_CI_Server_Certification_Test_Cases.git

3. #list /opt
    $ ls /opt
    OCP_CI_Server_Certification_Test_Cases

4. #enter source code directory
    $ cd OCP_CI_Server_Certification_Test_Cases

5. #new a branch named "sophia"
    $ git branch sophia

6. #checkout into branch "sophia"
    $ git checkout sophia

7. #check status
    $ git status

8. #add or modify source code what you want, then save it
    $ nano ...

9. #tell system that the file that you modified
    $ git add $FILE_PATH

10. #commit message
      $ git commit -m "message"

11. #repeat 8,9,10 steps if you have multiple files to modify

12. #go back branch "master"
      $ git checkout master

13. #merge code
      $ git merge sophia

14. #push code to Github
      $ git push

15. #enter the user and password you have applied after push the code


Note: How to set tag for source code version?

1. #clone source code
    $ git clone https://github.com/chilung/OCP_CI_Server_Certification_Test_Cases.git

2. #enter source code directory
    $ cd OCP_CI_Server_Certification_Test_Cases

2. # check tag information
    $ git tag
    show
    v1.0.0
    
3. # show detailed tag information
    $ git show v1.0.0
    tag 1.0.0
    Tagger: Chilung <chilung@itri.org.tw>
    Date:   Mon Apr 14 16:44:27 2014 +0800

    Version 1.0.0 Stable for OCP Winterfell Server Certification

    commit eaad99fad7b906389a165901b4140f7efdfec114
    Author: Nelson Chu <nelson.chu@itri.org.tw>
    Date:   Fri Apr 11 14:45:47 2014 +0800

        add installation guide and user manual to README.

    .............
    .............
    .............

4. #add tag and given version info.
    $ git tag -a v2.0.0 -m "Version 2.0.0 Stable for OCP Leopard Server Certification"
    $ git tag
    show
    v1.0.0
    v2.0.0

5. #push all tag to git server
    $ git push --tags
    #type user name and password

Note: If you want to checkout some tag, then you can ...

1. #clone all the source code
    $ git clone https://github.com/chilung/OCP_CI_Server_Certification_Test_Cases.git

2. # check tag information
    $ git tag -l
    show
    v1.0.0
    v2.0.0

3. #checkout to some tag (ex. tag v2.0.0)
    $ git checkout v2.0.0
    previous HEAD position was e432088... modify wording in ipmi_warm_reboot
    HEAD is now at eaad99f... add installation guide and user manual to README.



No comments:

Post a Comment