Detailed operation process
1. Establish a connection with a remote warehouse
First, right-click and select in the folder where you store these pulled down files
Enter in this interface
git clone <URL>
This binds our own remote warehouse. By entering the code, we can enter the file just pulled down and switch branches
cd net/ //进入文件夹名为net 的文件
2. View and switch branches
git branch -a can find the branch of the local warehouse. Because the clone statement is performed on it, a link is established between the local warehouse and the remote warehouse. Because it is a clone, then the equivalent of the remote branch is also cloned, so it can Seeing that the two are the same thing. git branch -r is the branch to view the remote warehouse
We just got the branch in the local warehouse, we can switch the branch next
git checkout branch name
Found that the branch name has been converted.
3. Pull the file and view the current file record
If you want to pull the branch file, you need to switch to the corresponding branch name first, and then write the statement on this basis
git pull //获取当前分支的远程仓库下的文件
git status //可以查看当前文件的记录
The place marked in red here shows that there is a file that has not been saved (untracked files)
4. Mark the files to be uploaded
git add git知识点整理.png //对单个文件进行标记 记得加上后面的文件类型名
git add . //偷懒方法,对所有文件进行标记,
The simplicity of this lazy method is that it eliminates the need for multiple single file markings.
5. Annotate the file and upload it
git commit -m"2021年3月31日" //这一步不可省略
git push //推送
6. Achievements display
Overall process code
git clone [email protected]:training-p2p/net.git // 绑定自己的远程仓库
cd net/ //进入到刚刚克隆下来的工程文件中(net为文件名)
git checkout dev-xxx //切换分支
//需要将要上传的文件放在刚刚克隆下来的文件夹中,才能继续下一语句
git add . //对需要上传的文件,进行标记
git commit -m "注释" //对上传文件进行备注
git push //推送文件