首页 > 其他分享 >git常用命令

git常用命令

时间:2023-10-11 11:12:14浏览次数:41  
标签:origin git remote -- add 常用命令 push

git global setup

git config --global user.name "yourname"
git config --global user.email "[email protected]"

Create a new repository

git clone [email protected]
cd theFileFoldYouCloned
touch README.md
git add README.md
git commit -m"add README"
git push -u origin master

Push an existing folder. ==> you need to have a blank project in remote 

cd existing folder
git init
git remote add origin [email protected]
git add .
git commit -m"Initial commit"
git push -u origin master

Push an existing Git repository

cd existing_repo
git remote rename origin old-origin
git remote add origin [email protected]
git push -u origin --all
git push -u origin --tags

Cancel the relate between local repo and remote repo

git remote remove origin

 

Other commands we commonly used

git fetch
git pull origin
git push origin
git push --set-upstream origin 'branch'
git merge --abort

  

标签:origin,git,remote,--,add,常用命令,push
From: https://www.cnblogs.com/codecheng/p/17756558.html

相关文章

  • Bug实录——配置了Github SSHKey之后还需要输入密码
    问题:换了一台新机器,pull了源码进行了更新,然后配置了github的sshkey,但在push时还是提示要输入密码,但我已经在github上关闭了密码提交权限(出于安全和便捷考虑)。然后就提交失败了。分析:可能是我是先pull的代码,然后才去设置的sskkey,导致本地仓库并没有同步到这个sshKey配置信息解......
  • 将Vue3项目部署到Github Pages
    1.创建vue3项目$npminitvue@latest初始化工程,并验证。2.创建github仓库3.连接vue项目到github仓库打开vue项目根目录,初始化本地git仓库$gitinit$gitadd.$gitcommit-m"init"连接vue项目到第二步创建的github仓库$gitremoteaddoriginhttps://gith......
  • git撤销、还原、放弃本地文件修改
    修改了代码但是不想提交了,下面3中情况,教你怎么操作!1.未使用gitadd缓存代码使用 gitcheckout--文件路径名 放弃某个文件修改gitcheckout--文件路径名使用gitcheckout. 放弃所有文件修改gitcheckout. 2.已经使用gitadd缓存代码,未使用......
  • git
    1.git介绍和安装1.首页功能写完了---》正常应该提交到版本仓库---》大家都能看到这个---》运维应该把现在这个项目部署到测试环境中---》测试开始测试---》客户可以看到目前做的情况需要有版本仓库,来管理我们的代码-svn:比较老,公司基本不用-git:比较流行,做代码管理2......
  • 前台首页、导出项目依赖、git介绍和安装、git,github,gitab,gitee介绍、git工作流程、git
    前台首页Header.vur<template><divclass="header"><divclass="slogan"><p>老男孩IT教育|帮助有志向的年轻人通过努力学习获得体面的工作和生活</p></div><divclass="nav"><ulclass="......
  • 如何解决Git仓库中的合并冲突?
    内容来自DOChttps://q.houxu6.top/?s=如何解决Git仓库中的合并冲突?如何解决我的Git仓库中的合并冲突?试试:gitmergetool它会打开一个GUI,逐步引导你解决每个冲突,并让你选择如何合并。有时候需要手动编辑一下,但通常它自己就够了。当然,它肯定比手工操作要好得多。根据Jos......
  • Git的安装与使用
    Git的安装与使用Git是一个免费开源的分布式版本控制系统,系统设计的目的是快速和高效地处理从小型到大型项目的所有内容下载官方下载网址:https://git-scm.com/downloads阿里云镜像站下载网址:https://registry.npmmirror.com/binary.html?path=git-for-windows/Standalone......
  • WSL2 配置过程及常用命令
    01WSL2安装1.1启动WSL以管理员身份启动Terminal运行如下命令dism.exe/online/enable-feature/featurename:Microsoft-Windows-Subsystem-Linux/all/norestart1.2启动虚拟机平台以管理员身份启动Terminal运行如下命令dism.exe/online/enable-feature/feat......
  • git上传至公共或私有github
    1.下载gitbash参考链接:https://git-scm.com/download2.创建git的秘钥gitconfig--globaluser.name"githubname"gitconfig--globaluser.email"githubemail"ssh-keygen-trsa-C"githubemail"其中:githubname是你的名称,githubemail是你的邮箱3.添加de......
  • Git Bash 版本回滚
    步骤:GitBash内1.cd到自己电脑的存储库2.查看历史版本gitlog 3.将下面指令中的<commit-hash>替换为要回滚版本的哈希值(步骤2中的黄色字体)gitreset--hard<commit-hash>gitpushorigin--force ......