Git basic

作者: YueTan | 来源:发表于2018-12-15 12:02 被阅读0次

个人项目

- clone the repository //this will copy all our team’s files to a local folder on your computer
- make your edits
- git add .    // update all files
- Commit : using -  git commit -a -m “message”
- git push

团队项目 learder

  • git branch dev //create a new branch called dev

  • git checkout dev //point to the new branch dev

  • git checkout master

  • git merge dev //first go to master brach and then merge the dev branch into master

  • git branch -d dev //after merge the dev branch, you can delete it if not used any more

团队项目 member

  • git pull to get the latest update of other members
  • git checkout dev //change the update into dev branch
  • git add -u --update //only add the changed file to repository
  • git add file_1 file_2 file_3 //add file_1, file_2 and file_3

some issue

git stash
git pull
git stash pop

服务器新建代码直接提交

  1. github上新建repo
  2. 已有项目文件夹
git init  # 初始化git项目
git add .
git commit -m "initial"
git remote rm origin
gir remote add origin "git@github.com:teletraan/Helmet.git"
git push -u origin master

彻底删除大文件的记录,防止git clone时间太久

  1. 列出所有仓库中的对象(包括SHA值、大小、路径等),并按照大小降序排列,列出TOP 10
git rev-list --all | xargs -rL1 git ls-tree -r --long | sort -uk3 | sort -rnk4 | head -10
  1. 根据最大文件的路径 {filepath},修改此文件的commit历史
git filter-branch --tree-filter "rm -f {filepath}" -- --all
  1. 强制提交到远程分支
git push -f --all

清理git仓库,变成新仓库

1.切换到新的分支

   git checkout --orphan latest_branch

  1. 缓存所有文件(除了.gitignore中声名排除的)
   git add -A

  1. 提交跟踪过的文件(Commit the changes)
   git commit -am "commit message"

  1. 删除master分支(Delete the branch)
   git branch -D master

5.重命名当前分支为master(Rename the current branch to master)

   git branch -m master

6.提交到远程master分支 (Finally, force update your repository)

   git push -f origin master

相关文章

  • 常用的Git指令

    Git 命令https://www.runoob.com/git/git-basic-operations.htm...

  • git基本使用命令

    (git下载地址) Git学习地址 http://www.yiibai.com/git/git_basic_con...

  • Windows git remote: HTTP Basic:

    1 问题描述: git push/ git fetch/ git pull,报 HTTP Basic: Acces...

  • Git

    Git Local Install Git Basic Skills Check Time Travel Remo...

  • git常用操作

    Basic Operation 分支管理切换分支git checkout git checkout -b #...

  • git使用中各类问题汇总

    git 报 HTTP Basic: Access denied 今天pull代码发现git 报错: git rem...

  • Git 记录

    参考: https://www.yiibai.com/git/git_basic_concepts.html 零零...

  • 入门级文章足够

    http://www.runoob.com/git/git-basic-operations.html https...

  • Git basic

    clone the project go into/return back the project list th...

  • GIt Basic

    ssh-keygen 在本地电脑中中生成钥匙 打开公钥id-rsa.pub ,将公钥copy到git网站的SSH ...

网友评论

      本文标题:Git basic

      本文链接:https://www.haomeiwen.com/subject/mezohqtx.html