*.pydevproject
.project
.metadata
bin/**
tmp/**
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# PDT-specific
.buildpath 1、配置语法:
以斜杠“/”开头表示目录;
以星号“*”通配多个字符;
以问号“?”通配单个字符
以方括号“[]”包含单个字符的匹配列表;
以叹号“!”对匹配结果取反;
此外,git 对于 .ignore 配置文件是按行从上到下进行规则匹配的,意味着如果前面的规则匹配的范围更大,则后面的规则将不会生效;
2、示例:
(1)规则:fd1/*
说明:忽略目录 fd1 下的全部内容;注意,不管是根目录下的 /fd1/ 目录,还是某个子目录 /child/fd1/ 目录,都会被忽略;
(2)规则:/fd1/*
说明:忽略根目录下的 /fd1/ 目录的全部内容;
(3)规则:
/*
!.gitignore
!/fw/bin/
!/fw/sf/
说明:忽略全部内容,但是不忽略 .gitignore 文件、根目录下的 /fw/bin/ 和 /fw/sf/ 目录;
三、Fork A Repo(在已有的项目上建立自己的仓库 [ 即fork ])
部分文档翻译、整理的内容:(红色字体是我的注释)
以项目名Spoon-Knife为例:
If you've found yourself on this page, we're assuming you're brand new to Git and GitHub. This guide will walk you through the basics and explain a little bit about how everything works along the way.
Contributing to a project
At some point you may find yourself wanting to contribute to someone else's project, or would like to use someone's project as the starting point for your own. This is known as "forking". For this tutorial, we'll be using theSpoon-Knifeproject, hosted on GitHub.com.
Step 1: Fork the "Spoon-Knife" repository(第一步,找到这个项目,点击 fork图标)
To fork this project, click the "Fork" button in the GitHub.com repository.
Step 2: Clone your fork(第二步,在shell窗口中输入如下命令)
You've successfully forked the Spoon-Knife repository, but so far it only exists on GitHub. To be able to work on the project, you will need to clone it to your local machine.
Run the following code:(命令如下)
git clone https://github.com/username/Spoon-Knife.git(注意要替换成自己的username) # Clones your fork of the repository into the current directory in terminal
Step 3: Configure remotes(第三步,配置一个映射到原始项目的流(upstream),用于从原始项目获取更新,输入下面两个命令)
When a repository is cloned, it has a default remote calledoriginthat points to your fork on GitHub, not the original repository it was forked from. To keep track of the original repository, you need to add another remote namedupstream:
More about remotes
cd Spoon-Knife
# Changes the active directory in the prompt to the newly cloned "Spoon-Knife" directory
git remote add upstream https://github.com/octocat/Spoon-Knife.git(命令1) # Assigns the original repository to a remote called "upstream"
git fetch upstream(命令2) # Pulls in changes not present in your local repository, without modifying your files
More Things You Can Do(more)
You've successfully forked a repository, but get a load of these other cool things you can do:
Pull in upstream changes(将原始项目中的更新合并到自己的master分支上)
If the original repository you forked your project from gets updated, you can add those updates to your fork by running the following code:
git fetch upstream
# Fetches any new changes from the original repository
git merge upstream/master
# Merges any changes fetched into your working files
Push commits(提交本地的更新(到本地master分支上)
Step 2: Commit your README
Now that you have your README set up, it's time to commit it. A commit is essentially a snapshot of all the files in your project at a particular point in time. In the prompt, type the following code:
More about commits
git add README
# Stages your README file, adding it to the list of files to be committed
git commit -m 'first commit'
# Commits your files, adding the message "first commit"
Step 3: Push your commit
So far, everything you've done has been in your local repository, meaning you still haven't done anything on GitHub yet. To connect your local repository to your GitHub account, you will need to set a remote for your repository and push your commits to it.
More about remotes
git remote add origin https://github.com/username/Hello-World.git
# Creates a remote named "origin" pointing at your GitHub repository
git push origin master
# Sends your commits in the "master" branch to GitHub
What is the difference between fetch and pull?
Create branches
Branching allows you to build new features or test out> How do I use branches?
Pull requests
If you are hoping to contribute back to the original fork, you can send the original author apull request.
Unwatch the main repository
When you fork a particularly popular repository, you may find yourself with a lot of unwanted updates about it. To unsubscribe from updates to the main repository, click the "Unwatch" button on themain repositoryand select "Not Watching".