“我有两个分支,即master和min,我希望能够将文件从master复制到min,但是要使用另一个名称。
我尝试了git checkout
class MainActivity : AppCompatActivity() {
lateinit var imageView: ImageView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
imageView = findViewById(R.id.imageView)
}
override fun onResume() {
super.onResume()
val url =
"https://images.unsplash.com/photo-1513618827672-0d7c5ad591b1?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9"
Glide.with(applicationContext).load(url).thumbnail(0.5f).dontAnimate()
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(imageView);
}
}
我希望将index.html复制为缩小
git checkout master index.html
答案 0 :(得分:3)
您可以这样做:
git checkout minified
git show master:index.html > index_from_master.html # get content and write to new file
此外,如果分支index.html
上不存在minified
:
git checkout minified
git checkout master -- index.html # checkout file
git mv index.html index_from_master.html # rename file
如果index.html
已经存在,并且您不想将其替换为master
中的版本,则可以先在index.html
中临时重命名minified
并执行上述操作。或没有临时重命名:
git checkout minified
git checkout master -- index.html # replacing the index.html from minified if any
git mv index.html index_from_master.html
git fetch origin
git checkout origin/minified -- index.html # get file back from working area