Git 常用

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档

文章目录

  • 一、Git 常用命令
    • 1.查看远程仓库地址
    • 2.切换内网网地址
    • 3.一般开发步骤
  • 二、issues


一、Git 常用命令

1.查看远程仓库地址


git remote -v

2.切换内网网地址


git remote origin set-url 地址

3.一般开发步骤


# 从远程仓库拉取最新的代码
 
git fetch origin master //将远程主机的最新内容拉到本地,由用户检查决定是否合并到工作本机分支中

git pull origin master //使用merge,有历史记录

git pull --rebase orgin  master //使用rebase,没有历史记录,简洁

# 创建分支
git switch -d 分支名称

# 查看当前分支
git branch

# 查看当前工作区状态
git status

# 开发完成提到暂存区
git add .

# 提交
git commit -m 提交的信息

# 切换分支
git switch master

# 合并分支
git merge 分支名称 //合并(merge/rebase)时出现冲突,在master上解决冲突在add commit 最后push

# 提交到远程仓库
git push origin master

# 合并回退
git reset --merge


二、issues


hint: Updates were rejected because the tip of your current branch is behind hint: its remote counte

第一次提交可能会存在这个问题,需要将本地仓库内容强制推送到远程仓库


git push  -f origin master 

你可能感兴趣的:(Git,git)