我想看看是否可以提交文件中的更改,但这样做后,存储库的所有文件都消失了。如何恢复之前的版本?
这是我所做的(请注意,这是我第一次连接到此 Git 服务器)。首先我初始化我的存储库:
$ rm -rf .git/
$ git init
$ git remote add origin https://remote.url/myProject.git
$ git commit -m "My first commit"
On branch master
Initial commit
Untracked files:
(use "git add <file>..." to include in what will be committed)
.foundry/
.gitignore
.teamcity/
GitVersion.yml
README.md
config.ini
block.py
view.py
entities.py
nothing added to commit but untracked files present (use "git add" to track)
Run Code Online (Sandbox Code Playgroud)
然后,因为我只修改了Entity.py,所以我将其添加到提交列表中:
$ git add entities.py
$ git status
On branch master
No commits yet …Run Code Online (Sandbox Code Playgroud) 我编写了一个小型控制台应用程序,可以在不使用任何可变变量的情况下更新类型记录。对于经验丰富的函数式程序员来说,这看起来很简单,但对我来说却是一项艰巨的工作。它有效,但有一件事我不满意。但在此之前,让我们从代码开始:
open System
//------------------------------------------------------------------------------------
// Type, no data validation to keep it simple
//------------------------------------------------------------------------------------
[<StructuredFormatDisplay("{FirstName} {LastName} is a {Age} year old {Sex}")>]
type Student = {
FirstName: string
LastName : string
Sex : char
Age: int
}
//------------------------------------------------------------------------------------
// I/O functions
//------------------------------------------------------------------------------------
let getConsoleChar message =
printf "\n%s" message
Console.ReadKey().KeyChar
let getConsoleString message =
printf "\n%s" message
Console.ReadLine()
let getConsoleInt = getConsoleString >> Int32.Parse //no tryparse to keep it simple, I'm sure you can type an integer
let isValidCommand command …Run Code Online (Sandbox Code Playgroud)