IDEA local projects associated with GitHub / GitLab project
1. Create a local git repository
Create a local git repository via the navigation bar above idea
or
cd [本地工程根目录]
git init //这个目录就变成了git可以管理的仓库
2. Add the files to the staging area
Select the file, shortcut keys Ctrl + Atl + A Add (right click and choose Git -> Add)
or
git add . //小数点 “.” ,意为添加文件夹下的所有文件;也可以将 “.” 换成具体的文件名,如果想添加项目中的指定文件,那就把 “.” 改为指定文件名即可
3. The file will be submitted to the local staging area warehouse
Shortcut Ctrl + K
or by adjusting the above idea Commit window, fill Commit information, click Commit
here to open the window Push directly by clicking Commit and Push
or
git commit -m "[注释说明]"
4. The native code associated with the repository github
git remote add origin [https的git网址]
If there is fatal: remote origin already exists error
the first input
git remote rm origin
Then enter
git remote add origin [https的git网址]
5. code upload
First the remote repository merged with local (eg README.md other documents not in the local repository)
git pull --rebase origin master
push the code to the remote library
git push -u origin master
Note by branch git view the current branch, via git checkout master switch to the main branch, push to other branches of empathy
* more than two steps may be required to enter a user name and password