当前位置:   article > 正文

ubuntu中git及git仓库的搭建及使用①_ubuntu系统将现有工程命令行创建git仓库

ubuntu系统将现有工程命令行创建git仓库

新建仓库第一次上传

git config --global user.email “you@example.com”    you@example.com 替换为你的邮箱
git config --global usr.name “Your Name”   Your Name 替换为你的用户名

1 git init            //初始化仓库

2 git add .           //添加当前目录下的所有文件到暂存区

3 git commit -m "first commit"     //将暂存区内容添加到仓库中,并打上备注信息first commit

4 git branch -M main       //创建主分支main

5 git remote add origin https://github.com/xiaolizero/8723du.git    //添加远程版本库:

6 git push -u origin main    //关联到远程的master 分支

git config --global -l     //查看git配置
  • 1

再次上传

git add .
git commit -m "first commit"
git push

列出所有分支

git branch
git branch -d (branchname)               //删除分支命令
  • 1
  • 2

创建一个叫做“feature_x”的分支,并切换过去:

git checkout -b fex
  • 1

切换回主分支:

git checkout master    //master为你的主分支

git branch -d fex      //删掉新建分支

git remote -v    //显示所有远程仓库:
git status      // 查看在你上次提交之后是否有对文件进行再次修改。
git stash         //贮藏修改
git stash drop       //删除贮藏
git pull      //更新你的本地仓库至最新改动
git merge <branch>      //合并其他分支到当前分支
git add <filename>      //告诉冲突已经解决

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/701036
推荐阅读
相关标签
  

闽ICP备14008679号