`
geeksun
  • 浏览: 952956 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

GIT 常用命令

 
阅读更多

1. 配置使用git仓库的username和email

git config --global user.name "username"  

git config --global user.email  "you@yourdomain.example.com"

 

2.  帮助命令

git help

 

3. git rm <file> 或 git remote rm <file> 从本地或远程版本库中删除文件

 

4. git add <file>  将工作文件修改提交到本地暂存区

git add dir1  ( 添加dir1这个目录,目录下的所有文件都被加入 )

git add f1 f2 (添加f1, f2文件)

git add . ( 添加当前目录下的所有文件和子目录 )

 

5. git show $id  展示某次提交的内容 

 

6.  git init  初始化一个仓库版本

 

7.  git remote -v  查看远程仓库权限

 

8.  git remote add [short name] [url]  添加远程版本库

git remote add origin git@xbc.me:wordpress.git

 

9.  从远程版本库Clone文件

git clone git@xbc.me:wordpress.git  

  

10.  如果你自动追踪文件,包括你已经手动删除的,状态为Deleted的文件  

git add -u  

  

11.  提交修改  

git commit –m "注释"  

  

12.  推送更新到远程服务器,语法为 git push [远程名] [本地分支]:[远程分支]  

git push origin master  

  

13.  查看文件状态  

git status  

  

14.  git remote set-url origin git@ github.com:robbin/robbin_site.git # 设置远程仓库地址(用于修改远程仓库地址)

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics