git创建存储库后如何首先提交

时间:2019-05-22 18:44:42

标签: git

我使用git。我创建了一个目录Reflections4,并在其中复制了一个文件。之后,我执行了git init。

### Create test data

mkdir test_dir; cd test_dir

for i in {1..30}; do shuf -i 1-540000 -n 500000 > test${i}.txt; done

### Method #1: based on sort and uniq

time sort test*.txt | uniq -c | sed -n 's/^ *30 //p' > intersect.txt

# real    0m23.921s
# user    1m14.956s
# sys     0m1.113s

wc -l < intersect.txt

# 53876

### Method #2: awk method in this answer

time \
awk ' { a[$0]++ } 
      FNR == 1 { b++ }
      END { for (i in a) { if (a[i] == b) { print i } } } ' \
    test*.txt \
  > intersect.txt

# real    0m11.939s
# user    0m11.778s
# sys     0m0.109s

wc -l < intersect.txt

# 53876

创建存储库后如何在git状态下显示初始提交

3 个答案:

答案 0 :(得分:0)

您尚未向存储库提交任何内容,仅进行了初始化。从下面链接的文档中,init创建一个空的存储库,并且不进行填充。某些服务(github / lab等)将使用自述文件或类似文件初始化存储库,必须提交该文件以进行跟踪。手动运行init不会这样做。

您必须将某些东西添加(提交)到空的仓库中才能看到它。这样,如果您git add lesson_1_reflections.txtgit commit -m "first commit",那么您将拥有可以查看的提交。

如果您尝试与远程存储库(托管在另一台服务器,github,gitlab,bitbucket等上)进行同步,则还必须执行其他步骤才能使两个存储库(本地和远程)对话彼此。

https://git-scm.com/docs/git-init

答案 1 :(得分:0)

步骤1:

git add lesson_1_reflections.txt

第2步:

git commit -m "<enter the desired commit message>"

第3步(设置了要插入的遥控器后):

git push

如果出现提示,请输入用户名和密码

答案 2 :(得分:0)

https://confluence.atlassian.com/bitbucketserver/basic-git-commands-776639767.html 在此网页上查找,您将找到所需的所有信息。

对于您而言,您必须通过以下方式将这些文件添加到存储库中

git add . // . means everything or "all"

git status // now you can see all the changes
git commit -m "Message that you want to send regarding this commit"
git push origin "whatever the branch name"(optional)