How to gitlab cl cd

To use GitLab CI/CD, all you need is an application codebase hosted in a Git repository, and for your build, test, and deployment scripts to be specified in a file called .gitlab-ci.yml, located in the root path of your repository.

需要写 gitlab-ci.yml 文件 来描述如何自动化 ci , cd

 

Once you’ve added your .gitlab-ci.yml configuration file to your repository, GitLab will detect it and run your scripts with the tool called GitLab Runner, which works similarly to your terminal.

写完以后用 gitlab runner 来执行 yml 文件


 

 

 

 

 

git tips

 

 

 

git push origin branch_name —- 更新本地update to remote
git pull origin branch name — 取远程其他人的更新
git stash —- 放弃本地更新

 


找出2次 commit 的区别

Use git log to view the commit history. Each commit has an associated revision specifier that is a hash key (e.g. 14b8d0982044b0c49f7a855e396206ee65c0e787 and b410ad4619d296f9d37f0db3d0ff5b9066838b39). To view the difference between two different commits, use git diff with the first few characters of the revision specifiers of both commits, like so:

If you want to get an overview over all the differences that happened from commit to commit, use git log or git whatchanged with the patch option:

参见 :   https://stackoverflow.com/questions/1786027/how-to-view-file-history-in-git

How to add local code to github

 

  1. Create a new repository on GitHub. You can also add a gitignore file, a readme and a licence if you want
  2.  Open Git Bash
  3. Change the current working directory to your local project.
  4. Initialize the local directory as a Git repository.
    git init
  5. Add the files in your new local repository. This stages them for the first commit.
    git add .
  6.  Commit the files that you’ve staged in your local repository.
    git commit -m "initial commit"
  7.  Copy the https url of your newly created repo
  8. In the Command prompt, add the URL for the remote repository where your local repository will be pushed.

    git remote add origin remote repository URL


    git remote -v
  9.  Push the changes in your local repository to GitHub.

    git push -f origin master

 

 

 

如果遇到错误 :  remote origin already exist  ,