[RUBY] How to use GitHub for super beginners (team development)

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

How to use GitHub for super beginners (team development)
[For super beginners] How to use autofocus: true
[Ruby] How to use slice for beginners
How to use binding.pry for view files
Must-see for beginners! How to manage your Xcode project on Github
[For beginners] How to debug in Eclipse
(For beginners) [Rails] Time saving tech! How to install and use slim
[For Rails beginners] Summary of how to use RSpec (get an overview)
How to use Swift's Codable Super personal memo
How beginners can upload their apps to GitHub
How to find OSS trends for web development
How to use an array for HashMap keys
Note how to use Swift super basic TableView
[Rails] How to use Gem'rails-i18n' for Japanese support
How to use nginx-ingress-controller with Docker for Mac
How to use Map
How to use rbenv
How to use letter_opener_web
How to use fields_for
How to use java.util.logging
How to use map
How to use collection_select
How to use Twitter4J
How to use active_hash! !!
How to use MapStruct
How to use hidden_field_tag
How to use TreeSet
[How to use label]
How to use identity
How to use hashes
How to use JUnit 5
How to use Dozer.mapper
How to use Gradle
How to use org.immutables
How to use java.util.stream.Collector
How to use VisualVM
How to use Map
How to implement login request processing (Rails / for beginners)
How to use an array for a TreeMap key
[Spring Boot] How to create a project (for beginners)
Java development for beginners to start from 1-Vol.1-eclipse setup
How to use Truth (assertion library for Java / Android)
[For those who create portfolios] How to use font-awesome-rails
Explanation of Ruby on rails for beginners ④ ~ Naming convention and how to use form_Tag ~
[Java] How to use Map
How to use Chain API
[Java] How to use Map
How to use Priority Queuing
[Rails] How to use enum
How to use JUnit (beginner)
How to use Ruby return
[Rails] How to use enum
How to use @Builder (Lombok)
[Swift] How to use UserDefaults
How to use java class
How to use Swift UIScrollView
[For super beginners] DBUnit super introduction
How to use Big Decimal
[Java] How to use Optional ②
[Java] How to use removeAll ()
How to use String [] args