Version Control System, IntelliJ IDEA, Create a Git Repository for a Project and push to multiple remotes-CarlZeng
IDEA, 无法识别 .yml文件,
配置错误,
导致: 无法全局搜索,双击会打开别的编辑器
怎么搞?
File > Setttings >
Editor > File and Code Templates
中间选Files > 点击+号
添加模版输入模版名字: Yml File,
后缀名: yml
应用,保存
https://blog.csdn.net/qq_56740595/article/details/119347514
A Usage Sample and Notes
Let’s focus on how would you switch Git remote repository? or adding multiple remote repository to sync with local branch,
Use cases: if you want to switch GitHub to GitLab or from GitLab to GitHub services.
if you want to add both GitHub and GitLab to sync with your local projects.
We can follow bellow steps in IntelliJ IDEA:
- Menu VCS > Enable Version Control Integration
- This will create/add git system to local driver/disk
- After Commit to local branches
- Usually we allready have lots of files, and historical commits…
- Menu VCS > Git > Remotes
- add renew remote, so new remote repository is connected.
- named initial: origin, Now we could adding multiple remote origin, I.e. origin_gitlab…
- Please Note: we can add multiple remotes as desired.
- Menu VCS > Git > Fetch
- got sync from remote repositroy, but not yet merge with your local branches.
- Now local and remote repository and commit is all in local driver, under git control, ready for next action.
- Note: if we have multiple Remotes, the tool will try to fetch remote branches and commits one by one, and ignore anyone if it failed to fetch(Let’s say one of the Account is closed)
- Menu VCS > Git > Branches > New Branch
- Now depends on which local branch we currently working on, we can merge or push local commits to remote branches; in my example, I will create a new Local Branch(I.e. SynctoGitLab) from master, and push it to gitlab remote repository.
- New Branch, will create a local new branch and contains all of the files and commits of ‘master’(usually)
- Menu VCS Git > Push
- NOW we can control how and where to push to, means to control push local new branch to which remote repository.
- [Push commits to ***] In the left hand of the window, selected the local new created branch means which local branch to sync from. “SynctoGitLab -> origin : SynctoGitLab” new
- Click on origin to chose the desired remote(git repository), i.e. new added remote: origin_gitlab.
- so Now it becomes: “SynctoGitLab -> origin_gitlab : SynctoGitLab” new
- that means it will sync/push local branch “SynctoGitLab” to remote “origin_gitlab” new branch “SynctoGitLab”, yes, it will create a new branch and sync with the local branch; now everything got in sync.
- We can operat Push again and push it to another remote(and so another same naming branch)
Share learning informations:
IntelliJ IDEA. Adding a Project to Git and GitHub