如何在我的本地机器上获取网站代码?

如何在我的本地机器上获取网站代码?

我的系统中有一个名为“git_repo”的本地 GIT 存储库,其中保存着网站的整个代码库(由其他人预先配置),包括所有的 jsps、js、css 等。

我使用以下命令在主存储库中创建本地 git 存储库:

git branch //to show the current branch
git checkout -b branch_local_name origin/Main_branch_name //to create local repository in current branch
git fetch //to fetch the current build

不小心,我删除了本地文件夹中的所有内容,我不知道该怎么做才能再次获取该网站的内容。

答案1

你能简单地使用克隆吗?

 git clone <remote-repo> <local-dir-that-is-empty>

完成此操作后,您就可以进行分支等操作了。

连续运行这些命令应该可以做到这一点:

cd ~
mkdir new_repo
cd new_repo
git clone <path-to-repo> .

答案2

$ git branch -a | grep BR_SO // to show all the branches
$ git checkout -b bug-<Jira_ID> origin/BR_<name> // make fix in the BR
$ git fetch

这将解决它

相关内容