嗨,我是ruby on rails的新手,我正在使用ruby on rails version 3创建一个应用程序。我遇到了麻烦,我有很多文件需要添加。我键入命令git status
,然后出现以下内容,然后输入git add .
,没有任何反应。我错过了什么?
$ git status
在分支主机上 未跟踪的文件: (使用" git add ..."包括将要提交的内容)
.CFUserTextEncoding
.DS_Store
.bash_history
.bash_profile
.bash_sessions/
.bashrc
.bundle/
.cache/
.config/
.gem/
.gitconfig
.heroku/
.local/
.mkshrc
.mplayer/
.netrc
.node-gyp/
.npm/
.oracle_jre_usage/
.profile
.rvm/
.ssh/
.subversion/
.viminfo
.zlogin
.zshrc
Applications/
Desktop/
Documents/
Downloads/
FrostWire/
Library/
Movies/
Music/
Pictures/
Public/
RubymineProjects/
homebrew/
keys.txt
workspace/
答案 0 :(得分:0)
看起来您已将主目录初始化为git repo。
如果你是git的新手,我建议你安装一个Gui客户端来使用git。 其中有很多,只是谷歌。
如果您仍想使用终端方法,请继续阅读:
请按照以下步骤操作
首先,使用public class AlachiqMakeLink extends EditText {
private static final String TAG = AlachiqMakeLink.class.getSimpleName();
private static final String DEFAULT_TEXT_COLOR = "FFFFFF";
private String mParkedText = "";
private boolean mIsBoldParkedText = true;
private String mParkedTextColor = DEFAULT_TEXT_COLOR;
private String mParkedHintColor = DEFAULT_TEXT_COLOR;
private String mText = null;
private enum TypingState {
Start, Typed
}
private TypingState mTypingState = TypingState.Start;
public AlachiqMakeLink(Context context) {
super(context);
init();
}
public AlachiqMakeLink(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public AlachiqMakeLink(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AlachiqMakeLink, defStyleAttr, 0);
mParkedText = a.getString(R.styleable.AlachiqMakeLink_parkedText);
if (mParkedText == null) {
mParkedText = "";
}
String hint = a.getString(R.styleable.AlachiqMakeLink_parkedHint);
mParkedTextColor = a.getString(R.styleable.AlachiqMakeLink_parkedTextColor);
if (mParkedTextColor == null) {
mParkedTextColor = AlachiqMakeLink.DEFAULT_TEXT_COLOR;
}
mParkedHintColor = a.getString(R.styleable.AlachiqMakeLink_parkedHintColor);
if (mParkedHintColor == null) {
mParkedHintColor = AlachiqMakeLink.DEFAULT_TEXT_COLOR;
}
mIsBoldParkedText = a.getBoolean(R.styleable.AlachiqMakeLink_parkedTextBold, true);
init();
if (hint != null) {
setPlaceholderText(hint);
}
a.recycle();
}
private void init() {
mText = "";
observeText();
mTypingState = TypingState.Start;
addTextChangedListener(new ParkedTextViewWatcher(this));
}
public String getParkedText() {
return mParkedText;
}
private int getBeginningPositionOfParkedText() {
int position = mText.length() - mParkedText.length();
if (position < 0) {
return 0;
}
return position;
}
private void goToBeginningOfParkedText() {
setSelection(getBeginningPositionOfParkedText());
}
private String getTypedText() {
if (mText.endsWith(mParkedText)) {
return mText.substring(0, getBeginningPositionOfParkedText());
}
return mText;
}
private void setTypedText(String typedText) {
mText = typedText;
observeText();
textChanged();
}
private void setEmptyText() {
setTypedText("");
}
public void setPlaceholderText(String placeholderText) {
Spanned hint = null;
String parkedTextColor = reformatColor(mParkedTextColor);
String parkedHintColor = reformatColor(mParkedHintColor);
if (mIsBoldParkedText) {
hint = Html.fromHtml(String.format("<font color=\"#%s\">%s</font><font color=\"#%s\"><b>%s</b></font>", parkedHintColor, placeholderText, parkedTextColor, mParkedText));
} else {
hint = Html.fromHtml(String.format("<font color=\"#%s\">%s</font><font color=\"#%s\">%s</font>", parkedHintColor, placeholderText, parkedTextColor, mParkedText));
}
super.setHint(hint);
}
// Call when TypedText is changed
private String observeText() {
return mText = getTypedText() + mParkedText;
}
private String reformatColor(String color) {
if (color.startsWith("#")) {
color = color.substring(1);
}
if (color.length() > 6) {
return color.substring(2);
}
return color;
}
private Spanned getHtmlText() {
String parkedTextColor = reformatColor(mParkedTextColor);
if (mIsBoldParkedText) {
return Html.fromHtml(String.format("<font color=\"#%s\">%s</font><font color=\"#%s\"><b>%s</b></font>", parkedTextColor, getTypedText(), parkedTextColor, mParkedText));
}
return Html.fromHtml(String.format("<font color=\"#%s\">%s</font>", parkedTextColor, getTypedText() + mParkedText));
}
private void textChanged() {
switch (mTypingState) {
case Start:
if (mText.length() <= 0) {
return;
}
setText(getHtmlText(), BufferType.SPANNABLE);
goToBeginningOfParkedText();
mTypingState = TypingState.Typed;
case Typed:
if (mText.equals(mParkedText)) {
mTypingState = TypingState.Start;
setText(getHtmlText(), BufferType.SPANNABLE);
return;
}
setText(getHtmlText(), BufferType.SPANNABLE);
goToBeginningOfParkedText();
default:
break;
}
}
private static class ParkedTextViewWatcher implements TextWatcher {
private AlachiqMakeLink mAlachiqMakeLink;
private boolean mIsDeleteText;
public ParkedTextViewWatcher(AlachiqMakeLink alachiqMakeLink) {
this.mAlachiqMakeLink = alachiqMakeLink;
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (before > 0) {
mIsDeleteText = true;
} else {
mIsDeleteText = false;
}
}
@Override
public void afterTextChanged(Editable s) {
mAlachiqMakeLink.removeTextChangedListener(this);
String text = s.toString();
if (mIsDeleteText) {
if (text.length() < mAlachiqMakeLink.getParkedText().length()) {
mAlachiqMakeLink.setEmptyText();
} else {
String parkedText = text.substring(mAlachiqMakeLink.getBeginningPositionOfParkedText() - 1);
if (!parkedText.equals(mAlachiqMakeLink.getParkedText())) {
mAlachiqMakeLink.setEmptyText();
} else {
mAlachiqMakeLink.setTypedText(text);
}
}
} else {
mAlachiqMakeLink.setTypedText(text);
}
mAlachiqMakeLink.addTextChangedListener(this);
}
}
}
命令导航到项目文件夹,如:
cd
然后,使用$ cd ~/path/to/the/your/project
查看您的项目文件夹是否已经是git repo。如果没有,请使用git status
使您的项目成为git repo。
然后您可以使用git init
正常添加所有项目文件(如果您要添加所有项目文件)
答案 1 :(得分:-1)
使用
检查遥控器列表git remote
安装git-cola UI用于stage / unstage并轻松提交文件。您还可以轻松查看文件中所做的更改。
在ubuntu中:
sudo apt-get install git-cola
转到您的app目录并编写命令
cola
它将显示文件中的所有更改。分阶段并提交它。