Git

From BlackBox Framework Wiki
Jump to: navigation, search

This page contains the instructions how to use Git for working with open BlackBox Component Builder GitHub repository in Windows.

1. Download and install Git client with default preferences. http://git-scm.com/download/win

2. Run "Git Gui" and add your name and email in Edit/Options...

Setup.png


3.To make some new project and work with it locally (for experiments and education)

3.1. Move folder with a project to some place, that does not require administrator rights for creation of new folders and files (for example, home directory or desktop)

3.1. Go to folder run pop-up menu at some empty space and choose Init Here.

1init.png

The hidden folder ".git" will be created, it will contain all data about repository (do not remove this folder)

3.3. For adding all files from folder to project run pop-up menu and choose "Git Add all files now".

2addallfiles.png

3.4. For fixation of project state use "Git Commit Tool". (If all files in red-titled area, push "Rescan" and they will move to green-titled area). Write some comment message and push "Commit" button.

3commit.png

3.5 Now you can change some code, stage changed files for commit (image bellow) and commit new changes (see 3.4).

Stagechangedtocommit.png

3.6 Finally you will have the project history ("Git History" in pop-up menu) with the ability to restore any project state or make the new branch for experiments.

4. To work with BlackBox project (hot editing of Center repository)

4.1. Register at http://github.com and send your login to d.ivan.krsk@gmail.com

4.2. Make ssh-key on your PC.

4.2.1. Open "Git Bash"

Gitbash.png


4.2.2. Make ssh-key with command: ssh-keygen -t rsa -C "your_email@example.com" press Enter several times until the process will not finish generation.

4.2.3. Copy new key to clipboard with command: clip < ~/.ssh/id_rsa.pub

Keygen.png


4.2.4. Close Git Bash

4.3. Add SSH key to GitHub following numbers in next image

Addsshkey.png


4.4. Start "Git GUI" from Windows Start menu and choose "Clone the existing repository"

4.5. Add this line to sources git@github.com:BlackBoxCenter/bbcb.git and any target folder on your PC

Gitclone.png

4.6 Then the precess of cloning will be finished you can make some changes in files, however the 'master' branch exists for stable releases, you need to make local 'development' branch with parent 'origin/development'. Call Branch/Create...

Dev.png

4.7. More save way is to make new one more local branch Branch/Create... for testing new feature or bug fix:

Newbranch.png

After creation you will be switched to new branch of project. You can change the current brunch by menu Branch/Checkout.


4.8. Then you can change the code, test it and commit the results to this temporary branch.

Demofix.png


4.9. After committing the changes in new branch, you need to merge your change with current state of project. Switch to 'master' branch Branch/Checkout.... Fetch the updates from 'origin' Remote/Fetch from/origin. Then you can choose Merge/Local merge, choose the branch to merge, and press Merge button.

Merge.png

4.10. Push the 'development' brunch to Center repository

Pushdevelopment.png

5. To work with a personal copy of BlackBox project (pull requests)

After registration (4.1), and adding ssh-key (4.2, 4.3) you can work with your copy (fork) of Center repository.

5.1. Making the fork. Go to: https://github.com/BlackBoxCenter/bbcb and push 'Fork' button:

Fork.png

5.2. Clone the repository with your repository path and repeat steps 4.6-4.8 for your copy.

Forkurl.png

5.3. Start pull request.

Pullrequest.png

5.4. Create pull request.

Createpullrequest.png