标签: git

如何着色git的输出?

有没有办法为 git(或任何命令)的输出着色?

考虑:

baller@Laptop:~/rails/spunky-monkey$ git status
# On branch new-message-types
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   app/models/message_type.rb
#
no changes added to commit (use "git add" and/or "git commit -a")
baller@Laptop:~/rails/spunky-monkey$ git add app/models
Run Code Online (Sandbox Code Playgroud)

baller@Laptop:~/rails/spunky-monkey$ git status
# On branch new-message-types
# Changes to be committed:
#   (use "git reset HEAD <file>..." to …
Run Code Online (Sandbox Code Playgroud)

colors bash git

308
推荐指数
5
解决办法
20万
查看次数

如何使用 apt-get 更新到更新版本的 Git?

我刚刚用 Ubuntu Oneiric 11.10 设置了一台新机器,然后运行

apt-get update
apt-get upgrade
apt-get install git
Run Code Online (Sandbox Code Playgroud)

现在如果我运行git --version它告诉我我有git version 1.7.5.4但在我的本地机器上我有更新的git version 1.7.9.2

我知道我可以从源代码安装以获得最新版本,但我认为尽可能多地使用包管理器来保持一切标准化是一个好主意。

那么是否可以使用apt-get来获取更新版本的git,正确的方法是什么?

ubuntu git apt upgrade

257
推荐指数
4
解决办法
32万
查看次数

类似于 SourceTree 的 GIT GUI

是否有类似于SourceTree的软件,一个用于 git 的 GUI,用于 Linux?我知道 Giggle、git cola 等。我正在寻找一个漂亮、易于使用的 git 图形用户界面。

software-rec gui git

159
推荐指数
7
解决办法
25万
查看次数

从脚本确定 Git 工作目录是否干净

我有一个rsync以 Git 工作目录作为目标运行的脚本。我希望脚本根据工作目录是否干净(没有更改提交)而具有不同的行为。例如,如果输出git status如下,我希望脚本退出:

git status
Already up-to-date.
# On branch master
nothing to commit (working directory clean)
Everything up-to-date
Run Code Online (Sandbox Code Playgroud)

如果目录不干净,那么我希望它执行更多命令。

如何在 shell 脚本中检查上述输出?

git shell-script

154
推荐指数
4
解决办法
6万
查看次数

从远程 git pull 但没有提取这样的引用?

我的磁盘上有一个 git 镜像,当我想用​​ git pull 更新我的仓库时,它给了我错误消息:

 Your configuration specifies to merge with the ref '3.5/master' from the remote, but no such ref was fetched.
Run Code Online (Sandbox Code Playgroud)

它还给了我:

  1ce6dac..a5ab7de  3.4/bfq    -> origin/3.4/bfq
  fa52ab1..f5d387e  3.4/master -> origin/3.4/master
  398cc33..1c3000a  3.4/upstream-updates -> origin/3.4/upstream-updates
  d01630e..6b612f7  3.7/master -> origin/3.7/master
  491e78a..f49f47f  3.7/misc   -> origin/3.7/misc
  5b7be63..356d8c6  3.7/upstream-updates -> origin/3.7/upstream-updates
  636753a..027c1f3  3.8/master -> origin/3.8/master
  b8e524c..cfcf7b5  3.8/misc   -> origin/3.8/misc
  * [neuer Zweig]     3.8/upstream-updates -> origin/3.8/upstream-updates
Run Code Online (Sandbox Code Playgroud)

当我运行 make menuconfig 时,它给了我 Linux 版本 3.5.7?这是什么意思?如何更新我的回购?

git

89
推荐指数
3
解决办法
19万
查看次数

创建没有密码的用户

我正在尝试创建一个没有密码的用户,如下所示:

sudo adduser \
   --system \
   --shell /bin/bash \
   --gecos ‘User for managing of git version control’ \
   --group \
   --disabled-password \
   --home /home/git \
   git
Run Code Online (Sandbox Code Playgroud)

它创建得很好。但是当我尝试在 git 用户下登录时,我输入了密码:

su git
Password:...
Run Code Online (Sandbox Code Playgroud)

当我把它留空时,我收到一个错误:

su: Authentication failed
Run Code Online (Sandbox Code Playgroud)

怎么了?

users ubuntu git not-root-user

86
推荐指数
5
解决办法
26万
查看次数

将 ~ 置于源代码控制之下的提示

我想将我的主目录 (~) 置于源代码管理之下(在本例中为 git),因为我有许多设置文件(.gitconfig、.gitignore、.emacs 等),我想在其中跨机器携带,将它们放在 Git 中会更方便检索它们。

我的主要机器是我的 MacBook,OS X 的设置方式,有很多我想忽略的文件夹(文档、下载、.ssh)。还有一些文件夹已经在使用 Git (.emacs.d)。

我的想法是将所有这些目录添加到我的 .gitignore 文件中,但这似乎有点令人厌烦,并且可能会导致一些无法预料的后果。我的下一个想法是定期将我想要存储的文件复制到家中的某个文件夹中,然后提交该文件夹。问题在于我必须记住在提交之前移动它们。

有没有干净的方法来做到这一点?

settings git version-control

76
推荐指数
4
解决办法
7581
查看次数

Git 子模块显示新提交,子模块状态表示没有提交

在 git 存储库中,我设置了 .gitmodules 文件以引用 github 存储库:

[submodule "src/repo"]
    path = src/repo
    url = repourl
Run Code Online (Sandbox Code Playgroud)

当我在这个 repo 上“git status”时,它显示:

On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

modified:   src/repo (new commits)
Run Code Online (Sandbox Code Playgroud)

如果我 cd 进入 src/repo 和 repo 上的 git status,它说没有什么可提交的。

为什么我的顶级 git repo 抱怨?

git

76
推荐指数
2
解决办法
6万
查看次数

如何使用 rsync 备份没有 git 子目录的目录

我想复制我的c目录以及不包括./git子目录的所有子目录。我使用rsync

echo "copy c and sh files "
rsync -a --include='*.c' --include='*.sh' --include='*/' --exclude='*' ~/c/ ~/Dropbox/Public/c
# remove .git directory = do not send it to dropbox. Thx to Tomasz Sowa
rm -rf ~/Dropbox/Public/c/.git
Run Code Online (Sandbox Code Playgroud)

我能做得更好吗?

git rsync dropbox

57
推荐指数
2
解决办法
4万
查看次数

`git pull` 是怎么吃掉我的作业的?

我感觉就像校长办公室里的一个孩子,解释说我的作业在到期前一天晚上被狗吃掉了,但我正盯着脸上的一些疯狂的数据丢失错误,我无法弄清楚它是怎么发生的。我想知道 git 怎么会吃掉我的整个存储库!我已经多次将 git 放入绞拧器中,它从不眨眼。我用它将 20 Gig Subversion 存储库拆分为 27 个 git 存储库,并将 foo 过滤分支出来以解决混乱问题,并且它从未在我身上丢失过一个字节。reflog 总是可以依靠的。这次地毯不见了!

从我的角度来看,我所做的只是运行git pull,它破坏了我的整个本地存储库。我的意思不是说它“弄乱了签出的版本”或“我所在的分支”或类似的东西。我的意思是整件事都没有了

这是事件发生时我的终端的屏幕截图:

事件截图

让我带你了解一下。我的命令提示符包含有关当前 git 存储库的数据(使用 prezto 的 vcs_info 实现),因此您可以查看 git 存储库何时消失。第一条命令就够正常了:

  » caleb » jaguar » ~/p/w/incil.info » ? ? zend ? »
??? git co master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
Run Code Online (Sandbox Code Playgroud)

在那里你可以看到我在 'zend' 分支上,并检查了 master。到现在为止还挺好。您将在我的下一个命令之前的提示中看到它成功切换了分支:

  » caleb » jaguar » ~/p/w/incil.info » ? ? master ? »
??? git pull
remote: Counting objects: …
Run Code Online (Sandbox Code Playgroud)

debugging git data-recovery

53
推荐指数
1
解决办法
3553
查看次数