I'm a beginner on GitHub As a procedure of Ruby team development, I will summarize it as a memorandum. I have a GitHub account and I also download GitHub Desktop It is assumed that. If anything is wrong, please let me know.
First, create a template for your app (the person who deploys it).
Terminal
% rails _6.0.0_new app name-d mysql #Development with mysql database
config/database.yml
python
default: &default
adapter: mysql2
encoding: utf8 #Change encoding.
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: root
password:
socket: /tmp/mysql.sock
Terminal
% rails db:create #Create database
This completes the app template.
From here, we will work on linking data to GitHUb. Follow the steps below.
(1) Create a local repository for the app you created earlier from GItHub Desktop. Select "Current Repository"-> "Add"-> "Add Existing Repository" in the upper left (2) Go to the relevant directory from the terminal and execute the "git init" command. By doing this, the app can be placed under git control. ③ Enter the following command from the terminal
git add App.rb
By entering this command, it will be added to the index. Enter the following command just in case
% git status
On branch master #If you do git status and the following sentence appears, all have been moved to the index
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file:Corresponding file.rb
Untracked files:
(use "git add <file>..." to include in what will be committed)
site/
④ Create a local repository of git-app from GItHub Desktop. Select "Current Repository"-> "Add"-> "Add Existing Repository" in the upper left. Select the app from choose and click "Add Repository". ⑤ Select and commit all the files in the local repository. The commit message at that time can be anything, but if you are unsure, use "Initial commit". ⑥ Connect with the remote repository. Click the [Publish repository] button from GitHub Desktop A remote repository for GitHub is created. ⑦ Now move to the remote GitHub top page. Success if the app is found in the Your repositories section of GitHub.
=========== This is the end of linking the app template to GitHub. Next, I will write that another member will create it for development as a team.
① Another member forks the app and clones it. Jump to the page of the corresponding application on GitHub (remote) and copy the URL. Press the fork button in the upper right. → Forked.
Go to the folder you want to clone in the terminal and execute the following command.
git clone URL of the copied application → cloned.
This will clone the app.
② Make a commit. After cloning, make an empty commit. But empty commits can't be committed from the GitHub desktop Enter the following command from the terminal to commit.
git commit -m 'initial commit'
You don't always have to commit first, After this, you must commit to issue a pull request. You don't have to make a separate pull request, but by making a pull request Because you can appeal to another team developer that you are implementing here now Conflicts can be reduced. In other words, I want to reduce conflicts → I want to make a pull request for that → First for that Make a commit.
③ After committing, cut a new topic branch from the master branch from GitHub Desktop. Make a pull request. The branch name should be what you will implement. Add WIP (work in progress) to the title. It is easy to understand if you write it in WHAT WHY. (It is desirable to write in markdown) By issuing a pull request, you can appeal to other members where you are implementing. Be careful not to make pull requests on the master branch.
④ Start development from the topic branch.
⑤ When completed, commit from the GitHub desktop.
⑥ If you get LGTM from another team member, delete the description of WIP. Alternatively, close the pull request. There is a button at the bottom of the remote.
⑦ Push.
⑧ Have the application developer (deployer) merge. After merging, it is recommended to delete it so that pull requests do not accumulate.
⑨ I want to pull it to the local repository, so Change the branch on your GitHub desktop to the master branch and pull. By doing this, the latest version of the data can be downloaded.
⑩ Since the local repository is the latest data Cut the topic branch again and proceed with the next development.
======= I heard that many people on GitHub are not used to it at first. It is recommended to proceed while checking step by step. Let's do our best together!
Recommended Posts