Use on Git
Preface
The document is about to introduce some specialties on PLM development and maintenance activities, we weren’t going to state everything about Git Usage. All content of the document written here describe only most helpful commands and steps.
Before you begin…
Before you begin reading, you should have already known some information about PLM, if you are unfamiliar with PLM absolutely, please refer to PLM Guide Document firstly.
Project Directories
Description: when you login Git server at the first time, you can view the directorys below.

At first, you need to know what projects must be downloaded for normal work. “appl-v6r2016x” and “tools”, the two one must be downloaded. Other projects are useful for improvement on PLM after you become an expert on PLM.
appl-v6r2016x:
it is project source code which could be modified through legal processes, containing all business source code and configuration property files customized for Luxottica PLM. All developers will modify the project if necessary.
interface:
PLM system will interact with SAP system, although, as a PLM professionals, SAP functionalities is not belonging to the domain of acknowledge for our work, but ,we have to know these interactive approaches between PLM and SAP system. So this project is related to this sake.
Tools:
Tools targets to help developers to revise some source code and make their modified code work normally in environment. Of course, developers could make their modification of source code work via uploading or deploying file to real environment manually. But it will be inefficient when they schedule to resolve many issues in parallel.
matrixone:
matrixone project almost contains all framework code. The source code of the project is good tutorial for senior programmer for researching internal technical information and learning more knowledge on software designed thought. I recommend you to learn the internal implementation if you feel bored and not exhausted after completion of tasks.
Establishment of Local Repository
Git Installation
Description: you can only install Git Client on your windows.
Most of staffs in Luxottica can’t download executable file from internet. Even they are able to obtain the installable package from elsewhere, installing any executable file requires administrative authentication before entering guidance program of software. Therefore, please contact Tristar IT support operation team that is in charge of all issues and jobs on software and hardware.
Clone Remote Repository
Description: after Git Installation completed, developers can download source code from remote repository.
- To attain the duplication of repository URL for cloning.

2. To locate a personalized directory that hold local source code repository, then get started of Git bash prompt in the directory.

3. Here is ‘clone’ command introduced to download resource code from remote Git repository.

Note:Git bash will prompt you to confirm the authenticity of host “lwplmgitp01(ip address)”, because your PC never connect to the Git server before, so you PC didn’t save public key of Git server. The prompt likely is :

Additionally, you must notice the message infos“Permission denied(publickey)”, it means you didn’t generate your PC’s publickey to Git server, Git server also need to verify client’s information with your PC’s public key.
Now, if you execute ‘clone’ command again, then the prompt will probably tell you:

if you don’t understand what I said above, please refer to SSH key document and set up SSH key firstly in order to be convenient later. After completion of SSH key, return here to continue to clone resource code.

4. After cloning process finished, go into the project directory downloaded just now.
Use “git branch” or ‘git branch -l’ to see local branch of the project.

5. As you can see from last step, perhaps there is only one branch mapped to remote Git repository. But if developers desire to track more branches in the local context. What commands could help them for the intention?
‘Git branch -r’ git command only help coders for listing all remote branches of the project, as you can see from the following result. There is pointer(origin/HEAD) representing to one of remote branches. (HEAD is a vital term across Git Usage, meaningful for you if you can understand, I described the concepts and what it was applied on daily works, click here for reference if you are interested)

6. So, there are alternatives you can download into local directory for more work.
Run the following command:
git checkout ‘branch_name’
here, for example :”git checkout v6r2016r”

Then, run command “git branch -l” to check if you have already downloaded successfully from remote server.

Editing
Checkout Repository
Description: for sure that you have already cloned resource code from remote server through the previous steps. I think you have already comprehended a little about ‘checkout’ command. Briefly, ‘checkout’ is a little dangerous command easily causing some unexpected loss of work effort if you don’t understand the usage of it. On advisory tips, I recommend you to study further about the command and firstly to set up a comprehensive understanding of the command before you get started in real work.
Assume that readers know how to download code from Git remote server, the following part is introduced to demonstrate several commands on ‘appl-v6r2016x’ project.

The above snapshot presents different local branches of ‘appl-v6r2016x’ project, but to be incredible, how do different branches exist in only a directory ’ D:\workspace\appl-v6r2016x’?
Please note all subdirectories of the directory, ‘.git’ is a special directory supposed to be used to support Git system. All necessary information is included to ‘.git’ directory. Differences from different branches are stored into the directory in a git-style format which Git easily handle. In order to get an absolute restoration of a branch, .git directory has to record changed information or logs before developer exchange branch from this branch to another one.

‘dev’ branch is the best branch you should choose firstly to add some new code for development task. After test is done successfully in dev branch, you should do the same modification in ‘cert’ and ‘prod’ branch as dev branch simultaneously.
the following pic shows the entire mechanic working in ‘.git’ directory.

The most surprising thing is that the entire cycle is unrelated to Git remote repository. The total cycle only runs beneath ‘.git’ directory. Execute command “git status”, check if you modified some codes, of course, if you don’t have any revision on resource code, ignoring it.

If Git shell bash prompt tell you did something unsaved (the red part clearly display the unsaved file).
What does that ‘Changes not staged for commit’ means? Let me explain more subsequently.
As you can see from the below structure of local Git system, you changed a file named “LuxotticaStringResource.properties” within the scope of Working Directory, before you can commit your change to Repository(local), the transmit place is staging area. You can execute command ‘git add ’ to move your changed resources files to staging area.

So the green part shows all files which I add them to staging area before.
Now, if I execute ‘git commit’ for committing my changed resource code, the green parts will be saved into repository (local), the red part will not be saved into Repository (local).
Why does the Git management need the area? One of reasons is that we can commit our changing resource file multiple times for different tickets respectively, perhaps you can know all reasons after you get understanding of Git comprehensively.
There are two other confusing log information, one shows the ‘git reset HEAD’ command, one shows the ‘git checkout ’ command.
As you can see from the below snapshot, ‘git checkout’ command can discard changes in working area, as I said before, the checkout command is a little dangerous, it can remove that you changed but not move to staging area.
For more information about reset command, please refer to Git official documentation.
Here I only explain the key wordHEAD,
Try to execute command ‘git checkout prod’
Configuring your personalized Git settings
Description: make sure you have installed Git Client in your computer. Now you should configure personalized Git Settings
SSH Key:
Before access to GitLab, you need to generate SSH key. SSH protocol provides security and allows you to authenticate to GitLab remote server without supplying your username and password each time. Please click here to see what SSH key is and how you configure SSH key.
Config file:



Check differences between two commits.


About HEAD
HEAD is important key work representing a key concept that Git users mention and use frequently. it is intrinsically a pointer which point to a commit (or you can understand it as revision) of a branch, usually the current commit of the current branch on which you are working.






Revision of remote GitLab Server
Description: Due to some reasons, PLM development team have to revise Gitlab Server address, moving all source codes and historical commits to other valid server. So developers should know how to adapt the activity. The following stages are going to tell you the details via an example.
- Immediately saving your important changes and local output (such as, customized files, source code files), git command: git status can help you for location of your needs.

2. Git command : git add . help you make your changes staged(if you don’t know what staged state is, you should refer to Git official site for it).

Git Stash
But before change from a branch to another branch, probably you didn’t save all modification you have done in this branch, so
‘git status’ command help you for details that you have done in the branch.



Use on Git的更多相关文章
- Git 子模块 - submodule
有种情况我们经常会遇到:某个工作中的项目需要包含并使用另一个项目. 也许是第三方库,或者你 独立开发的,用于多个父项目的库. 现在问题来了:你想要把它们当做两个独立的项目,同时又想在 一个项目中使用另 ...
- Git 在团队中的最佳实践--如何正确使用Git Flow
我们已经从SVN 切换到Git很多年了,现在几乎所有的项目都在使用Github管理, 本篇文章讲一下为什么使用Git, 以及如何在团队中正确使用. Git的优点 Git的优点很多,但是这里只列出我认为 ...
- Git与Repo入门
版本控制 版本控制是什么已不用在说了,就是记录我们对文件.目录或工程等的修改历史,方便查看更改历史,备份以便恢复以前的版本,多人协作... 一.原始版本控制 最原始的版本控制是纯手工的版本控制:修改文 ...
- Git Bash的一些命令和配置
查看git版本号: git --version 如果是第一次使用Git,你需要设置署名和邮箱: $ git config --global user.name "用户名" $ gi ...
- 在Ubuntu 16.10 安装 git 并上传代码至 git.oschina.net
1. 注册一个账号和创建项目 先在git.oschina.net上注册一个账号和新建一个project ,如project name 是"myTest". 2.安装git sudo ...
- 史上最详细git教程
题外话 虽然这个标题很惊悚,不过还是把你骗进来了,哈哈-各位看官不要着急,耐心往下看 Git是什么 Git是目前世界上最先进的分布式版本控制系统. SVN与Git的最主要的区别 SVN是集中式版本控制 ...
- [版本控制之道] Git 常用的命令总结(欢迎收藏备用)
坚持每天学习,坚持每天复习,技术永远学不完,自己永远要前进 总结日常开发生产中常用的Git版本控制命令 ------------------------------main-------------- ...
- 【解决方案】Myeclipse 10 安装 GIT 插件 集成 步骤 图解
工程开发中,往往要使用到集成GIT ,那么下面说说插件安装步骤 PS:以Myeclipse 10 为例,讲解集成安装步骤. ----------------------main------------ ...
- git 命令
切换仓库地址: git remote set-url origin xxx.git切换分支:git checkout name撤销修改:git checkout -- file删除文件:git rm ...
- git亲测命令
一.Git新建本地分支与远程分支关联问题 git checkout -b branch_name origin/branch_name 或者 git branch --set-upstream bra ...
随机推荐
- Emacs25.1之后UrlHttpError
Emacs25.1之后UrlHttpError */--> pre.src {background-color: #002b36; color: #839496;} pre.src {backg ...
- Android apiDemo 学习——对话框AlertDialogSamples
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/zpf8861/article/details/31423049 注意:该代码仅仅适用于当次简单调用对 ...
- 基于Linux平台病毒Wirenet.c解析
在分析Wirenet.c时,感觉自己学到了非常多非常赞的思想,希望跟大家一同交流. 转载请注明出处:http://blog.csdn.net/u010484477谢谢^_^ watermark/2/t ...
- 微信小程序の条件渲染
<view> 今天吃什么 </view> <view wx:if="{{condition==1}}">饺子</view> < ...
- 2018-2-13-git-cannot-lock-ref
title author date CreateTime categories git cannot lock ref lindexi 2018-2-13 17:23:3 +0800 2018-2-1 ...
- Redis 管道(pipeline)
- 2.java中c#中statc 静态调用不同之处、c#的静态构造函数和java中的构造代码块、静态代码块
1.java和c#静态成员调用的不同之处 static 表示静态的,也就是共享资源,它是在类加载的时候就创建了 java中 可以通过实例来调用,也可以通过类名.成员名来调用,但是一般最好使用类名. ...
- MyBatis 通过包含的jdbcType类型
BIT FLOAT CHAR TIMESTAMP OTHER UNDEFINED TINYINT REAL V ...
- 分享linux中导入sql文件的方法
为使用阿里云主机,没有装ftp,也没有装phpmyadmin,所以一切都得靠命令行.转移网站的重要一步就是转移数据库,这里简单介绍一下如何在这种情况下导入sql文件 因导出sql文件 在你原来的网站服 ...
- magento 为用户注册增加一个字段
步骤 I. 加一个occupation/title字段到用户注册页,差不多在register.html的54行,在email下方加一个Occupation显示代码 代码: <li>< ...