git使用小记

一.问题列表git

1.git: Your branch and 'origin/master' have diverged - how to throw away local commits?github

git fetch origin
git reset --hard origin/master

2、使用指南eclipse

1. 目前状态fetch

git status

2. 添加url

git add .

3. 提交code

git commit -m "pom merge"

4. 最后一步ip

git push origin master

5.永久删除提交的文件rem

git rm README.txt

git add .

git commit -m "xxx"

git push origin master

6.在eclipse中执行team->pull出现the current branch is not configured for pullit

解决方法: 
打开所在仓库的.git文件夹,修改config文件,加入以下参数:ast

[branch "master"]

        remote = master

        merge = refs/heads/master

[remote "master"]

        url = github上该仓库的地址

        fetch = +refs/heads/*:refs/remotes/origin/*

7.  .gitignore

当须要忽略某个文件,或者某个文件夹时,能够使用.gitignore添加须要忽略的文件。

可是添加完以后,若是以前提交过这个文件,则须要删除。

git rm --cached file_path
git commit -m 'del'
git push
相关文章
相关标签/搜索