markdown GitHub:个人备忘录和最佳实践

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown GitHub:个人备忘录和最佳实践相关的知识,希望对你有一定的参考价值。

# Cheat Sheet GitHub

## Git LFS
*Git* can work fine with 3D games out of the box. However the main caveat here is that versioning large (>5 MB) media files can be a problem over the long term as your commit history bloats.
Maybe use *DropBox* for art assets.

## Regular Branching
 * **Development branch** (also called ‘develop’) : This is your main development branch where all the others branches (e.g. feature branches) will be merging into this branch.
 * **Production branch** (also called ‘master’) : This branch represents the latest released / deployed codebase. Only updated by merging other branches into it.
 * **Feature branches** (also prefixed with ‘feature/’) : When you start work on anything non-trivial, you create a *feature branch*. When finished, you’ll merge this branch back into the development branch.
 * **Release branches** (also prefixed with ‘release/’) : When you’re about to package a new release, you create a *release branch* from the development branch. You can commit to it during your preparation for a release, and when it’s ready to be deployed, you merge it into both the development branch and the master branch.
 * **Hotfix branches** (also prefixed with ‘hotfix/’) : If you need to patch the latest release without picking up new features from the development branch, you can create a *hotfix branch* from the latest deployed code in master. Once you’ve made your changes, the hotfix branch is then merged back into both the master branch and the development branch.

## Unity Project : Github Settings
For versions of Unity 3D v4.3 and up:

* (Skip this step in v4.5 and up) Enable External option in Unity → Preferences → Packages → Repository.
* Open the Edit menu and pick Project Settings → Editor:
  * Switch Version Control Mode to Visible Meta Files.
  * Switch Asset Serialization Mode to Force Text. (By default already)
* Save the scene and project from File menu.

## Unreal Project : Github Settings
TODO

## Acknowledgements
Based on the following blog posts :
* [StackOverflow - How to use git for unity3d source control](https://stackoverflow.com/questions/18225126/how-to-use-git-for-unity3d-source-control/18225479#18225479)
* [Setting up Git Source Control in Editor](https://wiki.unrealengine.com/index.php?title=Git_source_control_(Tutorial)#Setting_up_Git_Source_Control_in_Editor)
* [Blog - Smart branching with sourcetree and git flow](https://blog.sourcetreeapp.com/2012/08/01/smart-branching-with-sourcetree-and-git-flow/)
* [Blog - A successful git branching model](https://nvie.com/posts/a-successful-git-branching-model/)
* [Atlassian - Comparing Workflows](https://www.atlassian.com/git/tutorials/comparing-workflows#!workflow-feature-branch)
* [GitHub - Git LFS](https://github.com/git-lfs/git-lfs/tree/master/docs?utm_source=gitlfs_site&utm_medium=docs_link&utm_campaign=gitlfs)
* [Unity Manuel - EditorManager](https://docs.unity3d.com/Manual/class-EditorManager.html)
# Useful commands
### Clone the central repository
`git clone https://user@host/path/to/repo.git`
* *Explanation(s)*: When you clone a repository, Git automatically adds a shortcut called origin that points back to the “parent” repository.

### Create a branch
`git checkout develop`

`git branch sprint-X/feature-1`

`git push --set-upstream origin sprint-X/feature-1`

### Rebase (instead of merge commit)
`git pull --rebase origin master`
* *Explanation(s)*: Rebasing allow to keep a cleaner history for a repository. 
* *Warning*: Use `rebase` only if the changes do not deserve a separate branch.

`git rebase --abort`
* *Explanation(s)*: Cancel a current rebase.

### Merge branches (instead of rebasing)
`git merge origin/develop`

### Checkout a branch
`git fetch origin`

`git checkout sprint-X/feature-1`

### Commiting (and pushing)
`git status`

`git diff "Folder/feature-1/script.cs"`

`git add . --all`

以上是关于markdown GitHub:个人备忘录和最佳实践的主要内容,如果未能解决你的问题,请参考以下文章

markdown 用于在Docker容器中运行本地Node项目的个人备忘单

山东大学 软件学院 2021年春季创新项目实训 个人总结

山东大学 软件学院 2021年春季创新项目实训 个人总结

作为程序员,这份Markdown备忘单你永远需要

如何用markdown编辑器排版github个人项目创建

Markdown备忘表