Giter Club home page Giter Club logo

git_tutorial's Introduction

git_tutorial

git教程 git remote set-url origin [email protected]:WeixianLin-cc/rl_deploy.git https://www.runoob.com/git/git-install-setup.html]

1.git clone // 到本地 2.git checkout -b xxx 切换至新分支xxx (相当于复制了remote的仓库到本地的xxx分支上 3.修改或者添加本地代码(部署在硬盘的源文件上) 4.git diff 查看自己对代码做出的改变 5.git add 上传更新后的代码至暂存区 6.git commit 可以将暂存区里更新后的代码更新到本地git 7.git push origin xxx 将本地的xxxgit分支上传至github上的git

(如果在写自己的代码过程中发现远端GitHub上代码出现改变) 1.git checkout main 切换回main分支 2.git pull origin master(main) 将远端修改过的代码再更新到本地 3.git checkout xxx 回到xxx分支 4.git rebase main 我在xxx分支上,先把main移过来,然后根据我的commit来修改成新的内容 (中途可能会出现,rebase conflict -----》手动选择保留哪段代码) 5.git push -f origin xxx 把rebase后并且更新过的代码再push到远端github上 (-f ---》强行) 6.原项目主人采用pull request 中的 squash and merge 合并所有不同的commit

远端完成更新后 1.git branch -d xxx 删除本地的git分支 2.git pull origin master 再把远端的最新代码拉至本地

本地项目初始化 在本地项目根目录进行git初始化 git init 此时会发现,命令行窗口出现git的master分支字样。 关联远程仓库 git remote add origin https://xxxxxxxxx.git 查看是否添加成功 git remote -v 此时已经展示关联好的远程仓库 提交代码 git add . git commit -m "一些描述" git push origin master 或 git push -u origin master

git push <远程主机名> <本地分支名>:<远程分支名>

git pull origin main --allow-unrelated-histories 拉取远程 main 分支的更改,并允许不相关的历史记录:

git_tutorial's People

Contributors

weixianlin-cc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.