git java eclipse 项目的 .gitignore 文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18726217/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 16:55:14  来源:igfitidea点击:

.gitignore file for java eclipse project

eclipsegit

提问by Casey Harrils

I have java project that uses the Eclipse IDE.

我有一个使用 Eclipse IDE 的 java 项目。

The Eclipse workspace is pointing to this directory:

Eclipse 工作区指向这个目录:

/home/srvimgprd/BUSPROJ/code_development/dime/executables/clientcode/java_axis/Eclipse

I have placed a .gitignorefile in the workspace directory"Eclipse". See below.

.gitignore工作区目录“Eclipse”中放置了一个文件。见下文。

What I need to do is to be able to download the items from the Eclipse directory onto a new machine and then compile with no issue.

我需要做的是能够将 Eclipse 目录中的项目下载到新机器上,然后编译没有问题。

Are there any concrete steps to accomplish this task? When using the .gitignorefile below, nothing shows up on the target machine.

是否有任何具体步骤来完成这项任务?使用.gitignore下面的文件时,目标机器上没有显示任何内容。



CONTENTS OF ECLIPSE DIRECTORY (on sourcemachine): /home/srvimgprd/BUSPROJ/code_development/dime/executables/clientcode/java_axis/Eclipse

ECLIPSE 目录的内容(在机器上):/home/srvimgprd/BUSPROJ/code_development/dime/executables/clientcode/java_axis/Eclipse



java_axis/Eclipse> ls -lart
total 48
drwxr-xr-x 2 imgdev development 4096 2013-09-09 04:53 RemoteSystemsTempFiles
drwxr-xr-x 4 imgdev development 4096 2013-09-09 04:55 Servers
drwxr-xr-x 4 imgdev development 4096 2013-09-09 04:58 .metadata
drwxr-xr-x 6 imgdev development 4096 2013-09-09 05:06 Axis2ClientDimeServer
drwxr-xr-x 5 imgdev development 4096 2013-09-10 08:30 ..
-rw-r--r-- 1 imgdev development  307 2013-09-10 08:31 .gitignore
drwxr-xr-x 6 imgdev development 4096 2013-09-10 08:31 .


CONTENTS OF .gitignore FILE

.gitignore 文件的内容



*target*
*.jar
*.war
*.ear
*.class

# eclipse specific git ignore
*.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

采纳答案by Marcin Szymczak

put .gitignore in your main catalog

将 .gitignore 放在您的主目录中

git status (you will see which files you can commit)
git add -A
git commit -m "message"
git push

回答by Ted Percival

You need to add your source files with git addor the GUI equivalent so that Git will begin tracking them.

您需要使用git add或等效的 GUI添加源文件,以便 Git 开始跟踪它们。

Use git statusto see what Git thinks about the files in any given directory.

git status看什么混帐想着在任何给定的目录中的文件。