git 常用命令

1、git branch -b your-branch   新建分支并切换多分支

2、git branch -d your-branch   删除指定分支

3、git branch -a   显示所有分支

4、git push origin --delete  your-branch   删除远程分支

5、git checkout -b local-branch origin/your-branch    check out 远程分支(origin/your-branch)到本地分支(local-branch)

6、git reset --hard commit-id  回退版本到commit-id版本

7、git fetch -p  更新本地缓存的所有远程分支(大概是这个意思)

8、git status 查看当前分支上,本地文件变化情况,带 branch clean 字样的就是没变化,如果有变化会提示,我的编译器提示的是红色的信息(变化的文件红色显示文件具体路径以及文件名)

9、git add .   该命令是将当前目录下所有变化的文件全部添加暂存区(不太确定是不是叫暂存区),反正基本是都是本地有变化,想要提交到版本库,先git add ,将变化的文件全部加完之后,git commit -m "对本次提交的说明",都是这个流程

10、最后一步,git push ,第9条命令就是为了他服务的,就是将9所添加的文件提交到版本库,注意::只有在本地改变的文件全部add,并且commit 以后,git push 才会成功

11、git pull  把版本库的代码拉倒本地,就是一个同步

想到啥写的啥,没什么条理可言,将就看吧,绝不是瞎写的,亲测。。

时间: 2024-08-04 10:18:26

git 常用命令的相关文章

【前端小小白的学习之路】Git常用命令整理

Git 常用命令清单. 几个专用名词的译名如下: Workspace:工作区 Index / Stage:暂存区 Repository:仓库区(或本地仓库) Remote:远程仓库 一.新建代码库 # 在当前目录新建一个Git代码库 $ git init # 新建一个目录,将其初始化为Git代码库 $ git init [project-name] # 下载一个项目和它的整个代码历史 $ git clone [url] 二.配置 Git的设置文件为.gitconfig,它可以在用户主目录下(全局

git常用命令2

git常用命令2 添加远程仓库(以github为例) 登录官方网站https://github.com,没有的话去注册一个账号吧. 然后新建一个仓库 在Repository name填入learngit,其他保持默认设置,点击"Create repository"按钮,就成功地创建了一个新的Git仓库: 目前,在GitHub上的这个learngit仓库还是空的,GitHub告诉我们,可以从这个仓库克隆出新的仓库,也可以把一个已有的本地仓库与之关联,然后,把本地仓库的内容推送到GitHu

iOS开发——开发技巧&Git常用命令

Git常用命令 初始化git init        加—bare实现远程仓库 配置git config user.name iCocos 配置全局git config —global user.name iCocosgit config —global user.email [email protected] 状态git status 添加到帮派git add iCocos.m 提交git commit iCocos.m -m “注释” Log纪录git loggit log + 文件名git

git常用命令符

全局配置 $ git config --global user.name "姓名" 告诉git你是谁 $ git config --global user.email "[email protected]" 告诉git怎么联系你 如果注册了 github 账号,邮箱最好和 github 账号统一 $ git config -l 查看配置信息初始化代码仓库 $ git init 初始化代码库 $ git add . 将所有变化添加到暂存区 $ git commit -

(小组)Git 常用命令整理

Git 常用命令整理 取得Git仓库 初始化一个版本仓库 git init Clone远程版本库 git clone [email protected]:wordpress.git 添加远程版本库origin,语法为 git remote add [shortname] [url] git remote add origin [email protected]:wordpress.git 查看远程仓库 git remote -v 提交你的修改 添加当前修改的文件到暂存区 git add . 如果

github创建远程仓库和git常用命令

git创建远程仓库 首先到github页面上创建仓库(repository)如下: 然后初始化文件夹为仓库,并提交到远程仓库,如下: [[email protected] aa]# git init Initialized empty Git repository in /data/mydata/aa/.git/ [[email protected] aa]# git add . [[email protected] aa]# git commit -m "first commit"

Git 常用命令集锦

远程仓库相关命令 克隆远程仓库:git clone git://github.com/jquery/jquery.git 查看远程仓库:git remote -v 添加远程仓库:git remote add [name] [url] 删除远程仓库:git remote rm [name] 修改远程仓库:git remote set-url --push [remoteName] [newUrl] 拉取远程仓库:git pull [remoteName] [remoteBranchName]:[l

windows下安装git并创建一个仓库,git常用命令

转载于:http://www.cnblogs.com/nemotan/p/4655498.html 一.windows安装git 1.下载:http://msysgit.github.io/,下载之后直接安装,打开gitbash 2.配置用户名和邮箱: $ git config --global user.name "Your Name" $ git config --global user.email "[email protected]" 3.新建一个文件夹并执

git常用命令及技巧

强推,即利用强覆盖方式用你本地的代码替代git仓库内的内容 git push -f git fetch --prune  #这样就可在本地删除在远程不存在的branch man git-fetch --prune After fetching, remove any remote tracking branches which no longer exist on the remote. -t, --tags Most of the tags are fetched automatically

Git 常用命令速查

一. Git 常用命令速查 git branch 查看本地所有分支 git status 查看当前状态 git commit 提交 git branch -a 查看所有的分支 git branch -r 查看远程所有分支 git commit -am "init" 提交并且加注释 git remote add origin [email protected]1.119:ndshow git push origin master 将文件给推到服务器上 git remote show or