我想从上游分支拉出来,我想忽略我在本地和我的远程git上做的所有提交.我只想从上游远程进行更改.
我有问题:
git pull upstream master
Run Code Online (Sandbox Code Playgroud)
而且我不想手动合并它们.我只想忽略所有本地更改和上面的命令.
我试过了:
git reset --hard
Run Code Online (Sandbox Code Playgroud)
但这似乎对我不起作用.我想从上游改变.
这可能是基于标记的意见.但我正在寻找标准/最佳实践.我正在构建一个Angular 2应用程序,我必须在我在模板中显示之前操作API中的数据.例如,如果我的服务如下:
getData(id: number): Observable<Data> {
return this.http
.get(this.url + '/' + id)
.map((res) => {
return res.json().data;
});
}
prepareData(data) {
// manipulate and return the data
}
Run Code Online (Sandbox Code Playgroud)
在我的组件上,我可以像这样调用服务:
getData(id: number): void {
this.dataService.getData(id)
.subscribe((data: Data) => {
this.showData = this.dataService.prepareData(data)
};
}
Run Code Online (Sandbox Code Playgroud)
但这是标准方法吗?或者该prepareData功能是否应该包含在组件中?
另一种表达方式是,与组件相比,服务是否应该很重,或者它应该很轻,只是作为获取数据的接口?
我正在完成 Rust 书第 8 章中的练习。但是这个问题并不是特定于该练习的。它特定于此行:*entry.push(name)。我试图取消引用条目以使向量推入我的值,但出现此错误:
error[E0614]: type `()` cannot be dereferenced
--> src/main.rs:36:17
|
36 | *entry.push(name)
| ^^^^^^^^^^^^^^^^^
Run Code Online (Sandbox Code Playgroud)
根据 VSCode 的 Rust 分析器, 的类型entry是&mut Vec<&&str>. 我怀疑&&可能不是一个原因&导致了这个问题。但我不知道为什么 VSCode 会这么想。谁能告诉我我在这里做错了什么?
这是完整的代码:
use std::{io::{self}, collections::HashMap};
fn main() {
let mut store = HashMap::new();
loop {
println!("Enter a command:");
let mut command = String::new();
io::stdin()
.read_line(&mut command)
.expect("Failed to read command");
let split_command: Vec<&str> = command.split_whitespace().collect();
match split_command.as_slice() {
["Add", name, "to", department] …Run Code Online (Sandbox Code Playgroud)