Remember a Git & GitHub practice
1 Introduction
Before writing a program called typora-tools
gadgets, the main achievement of the picture thin, title number, picture synchronization features, and now want to upload the project to GitHub and record what IDEA Maven project version control via Git, and pushed to GitHub Some common operations
2. Pre-work
First replace the password information in the configuration file.
I have replaced the secret key information for Alibaba Cloud OSS login here
# 是否需要进行图片清理
isNeedCleanPic=true
# 是否需要进行标题编号
isNeedTiltleAutoNo=true
# 是否需要进行图片同步
isNeedPicSyncOSS=true
# 笔记的根目录(也可以填入单个的 .md 文件)
noteRootPath=<输入你的笔记存储路径>
# 阿里云 OSS 配置信息
endPoint=<输入你的 endpoint>
bucketName=<输入你的 bucketName>
accessKeyId=<输入你的 accessKeyId>
accessKeySecret=<输入你的 accessKeySecret>
bucketDomain=<输入你的 bucketDomain>
Write REAME.md file
Write the README.md file first, then push it to the remote warehouse together
3. Configure .gitignore
Configure the .gitignore file
The following are files that need to be ignored (not added to version control)
So we created a new .gitignore file in the project homepage and added the following configuration
4. Initialize the Git repository
Execute
git init
initialize the local warehouse
The implementation of the project root directory git init
command to initialize the Git repository
5. Local version control
Perform add and commit operations
Execution git add .
will submit all files to the staging area
Heygo@LAPTOP-0RRBU253 MINGW64 ~/Desktop/Codes/typora-tools (master)
$ git add .
warning: LF will be replaced by CRLF in pom.xml.
The file will have its original line endings in your working directory
Execute git commit -m '<description>'
command staging area code submitted to the local repository
Heygo@LAPTOP-0RRBU253 MINGW64 ~/Desktop/Codes/typora-tools (master)
$ git commit -m 'Version 1.0'
[master (root-commit) 0d17c04] Version 1.0
14 files changed, 1479 insertions(+)
create mode 100644 .gitignore
create mode 100644 README.md
create mode 100644 pom.xml
create mode 100644 src/main/java/com/Entity/ResultEntity.java
create mode 100644 src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java
create mode 100644 src/main/java/com/heygo/typora/config/OSSConfig.java
create mode 100644 src/main/java/com/heygo/typora/config/TyporaToolConfig.java
create mode 100644 src/main/java/com/heygo/typora/main/TyporaTools.java
create mode 100644 src/main/java/com/heygo/typora/util/OSSUtil.java
create mode 100644 src/main/java/com/heygo/typora/util/TyporaFileRwUtil.java
create mode 100644 src/main/java/com/heygo/typora/util/TyporaOSSPicSyncUtil.java
create mode 100644 src/main/java/com/heygo/typora/util/TyporaPicCleanUtil.java
create mode 100644 src/main/java/com/heygo/typora/util/TyporaTiltleAutoNoUtil.java
create mode 100644 src/main/resources/typora-tool.properties
6. Remote version control
Create a new GitHub remote repository
Push local code to remote warehouse
Execute git push
commands will be pushed to master project local branch of a remote repository, pay attention to the first push you need to specify a remote repository URL address and branch name
Heygo@LAPTOP-0RRBU253 MINGW64 ~/Desktop/Codes/typora-tools (master)
$ git push https://github.com/oneby1314/typora-tools.git master
Enumerating objects: 32, done.
Counting objects: 100% (32/32), done.
Delta compression using up to 8 threads
Compressing objects: 100% (21/21), done.
Writing objects: 100% (32/32), 15.71 KiB | 2.24 MiB/s, done.
Total 32 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), done.
To https://github.com/oneby1314/typora-tools.git
* [new branch] master -> master
Wow, get it done, finish work