From 49b518faa3fc4ad1d31afa2b75c449be0047c6ac Mon Sep 17 00:00:00 2001 From: subi Date: Fri, 6 May 2022 19:59:25 +0800 Subject: [PATCH 1/7] day 37 --- zh_tw/Days/day37.md | 201 +++++++++++++++++++++++--------------------- 1 file changed, 104 insertions(+), 97 deletions(-) diff --git a/zh_tw/Days/day37.md b/zh_tw/Days/day37.md index fd520d9..fb2a0e1 100644 --- a/zh_tw/Days/day37.md +++ b/zh_tw/Days/day37.md @@ -1,173 +1,180 @@ --- -title: '#90DaysOfDevOps - Gitting to know Git - Day 37' +title: '#90DaysOfDevOps - Git 入門 - 第 37 天' published: false -description: 90DaysOfDevOps - Gitting to know Git +description: 90DaysOfDevOps - Git 入門 tags: "devops, 90daysofdevops, learning" cover_image: null canonical_url: null id: 1048707 --- -## Gitting to know Git +## Git 入門 -Apoligies for the terrible puns in the title and throughout. I am surely not the first person to turn Git into a dad joke! +本篇的作者在這裡很有趣玩諧音梗,把英文的 Getting to know Git改寫成 Gitting to know Git。 -In the last two posts we learnt about version control systems, and some of the fundamental workflows of git as a version control system [Day 35](day35.md) Then we got git installed on our system, updated and configured. We also went a little deeper on the theory between Client-Server version control system and Git which is a distributed version control system [Day 36](day36.md). +在前兩篇文章中我們學習了有關版本控制,[第35天](day35.md) and some of the fundamental workflows of git as a version control system [ Then we got git installed on our system, updated and configured. We also went a little deeper on the theory between Client-Server version control system and Git which is a distributed version control system [Day 36](day36.md). Now we are going to run through some of the commands and use cases that we will all commonly see with git. -### Where to git help with git? +### Where to git help with git? -There is going to be times where you just cannot remember or just don't know the command you need to get things done with git. You are going to need help. +There is going to be times where you just cannot remember or just don't know the command you need to get things done with git. You are going to need help. -It goes without saying that google or any search engine is likely to be your first port of call when searching help. +It goes without saying that google or any search engine is likely to be your first port of call when searching help. -Secondly the next place is going to be the official git site and the documentation. [git-scm.com/docs](http://git-scm.com/docs) Here you will find not only a solid reference to all the commands available but also lots of different resources. +Secondly the next place is going to be the official git site and the documentation. [git-scm.com/docs](http://git-scm.com/docs) Here you will find not only a solid reference to all the commands available but also lots of different resources. ![](Images/Day37_Git1.png) -We can also access this same documentation which is super useful if you are without connectivity from the terminal. If we chose the `git add` command for example we can run `git add --help` and we see below the manual. +We can also access this same documentation which is super useful if you are without connectivity from the terminal. If we chose the `git add` command for example we can run `git add --help` and we see below the manual. ![](Images/Day37_Git2.png) -We can also in the shell use `git add -h` which is going to give us a short summary of the options we have available. +We can also in the shell use `git add -h` which is going to give us a short summary of the options we have available. ![](Images/Day37_Git3.png) -### Myths surrounding Git +### 圍繞在 Git 的神話 -"Git has no access control" - You can empower a leader to maintain source code. +"Git has no access control" - You can empower a leader to maintain source code. -"Git is too heavy" - Git has the ability to provide shallow repositories which basically means a reduced amount of history if you have large projects. +"Git 太肥 - Git has the ability to provide shallow repositories which basically means a reduced amount of history if you have large projects. -### Real shortcomings +### 真正的缺點 -Not ideal for Binary files. Great for source code but not great for executable files or videos for example. +對二進位檔案來說並不適合。Git適合用在原始碼,但如果是執行檔或影片這些例子就不適用。 -Git is not user friendly, the fact that we have to spend time talking about commands and functions of the tool is probably a key sign of that. +Git 對使用的人並不友善,事實上我們必須花費時間討論命令和功能。 the fact that we have to spend time talking about commands and functions of the tool is probably a key sign of that. -Overall though, git is hard to learn, but easy to use. +整理來說,Git 困難但易用。 -### The git ecosystem +### Git 生態系統 -I want to briefly cover the ecosystem around git but not deep dive into some of these areas but I think its important to note these here at a high level. +I want to briefly cover the ecosystem around git but not deep dive into some of these areas but I think its important to note these here at a high level. -Almost all modern development tools support Git. +Almost all modern development tools support Git. -- Developer tools - We have already mentioned visual studio code but you will find git plugins and integrations into sublime text and other text editors and IDEs. - -- Team tools - Also mentioned around tools like Jenkins from a CI/CD point of view, Slack from a messaging framework and Jira for project management and issue tracking. +- Developer tools - We have already mentioned visual studio code but you will find git plugins and integrations into sublime text and other text editors and IDEs. +- Team tools - Also mentioned around tools like Jenkins from a CI/CD point of view, Slack from a messaging framework and Jira for project management and issue tracking. +- Cloud Providers - All the large cloud providers support git, Microsoft Azure, Amazon AWS, Google Cloud Platform. +- Git-Based services - Then we have the GitHub, GitLab and BitBucket of which we will cover in more detail later on. I have heard these services as the social network for code! -- Cloud Providers - All the large cloud providers support git, Microsoft Azure, Amazon AWS, Google Cloud Platform. - -- Git-Based services - Then we have the GitHub, GitLab and BitBucket of which we will cover in more detail later on. I have heard these services as the social network for code! +### Git 備忘紙條 -### The Git Cheatsheet +We have not covered most of these commands but having looked at some cheatsheets available online I wanted to document some of the git commands and what their purpose are. We don't need to remember these all, and with more hands on practice and using you will pick at least the git basics. -We have not covered most of these commands but having looked at some cheatsheets available online I wanted to document some of the git commands and what their purpose are. We don't need to remember these all, and with more hands on practice and using you will pick at least the git basics. +I have taken these from [atlassian](https://www.atlassian.com/git/tutorials/atlassian-git-cheatsheet) but writing them down and reading the description is a good way to get to know what the commands are as well as getting hands on in every day tasks. -I have taken these from [atlassian](https://www.atlassian.com/git/tutorials/atlassian-git-cheatsheet) but writing them down and reading the description is a good way to get to know what the commands are as well as getting hands on in every day tasks. +### Git Basics -### Git Basics -| Command | Example | Description | -| --------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | -| git init | `git init ` | Create an empty git repository in specified directory. | -| git clone | `git clone ` | Clone repository located at onto local machine. | -| git config | `git config user.name` | Define author name to be used for all commits in current repository `system`, `global`, `local` flag to set config options. | -| git add | `git add ` | Stage all changes in for the next commit. We can also add and <.> for everything. | -| git commit -m | `git commit -m ""` | Commit the staged snapshot, use to detail what is being committed. | -| git status | `git status` | List files that are staged, unstaged and untracked. | -| git log | `git log` | Display all commit history using the default format. There are additional options with this command. | -| git diff | `git diff` | Show unstaged changes between your index and working directory. | +| Command | Example | Description | +| --------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| git init | `git init ` | Create an empty git repository in specified directory. | +| git clone | `git clone ` | Clone repository located at onto local machine. | +| git config | `git config user.name` | Define author name to be used for all commits in current repository`system`, `global`, `local` flag to set config options. | +| git add | `git add ` | Stage all changes in for the next commit. We can also add and <.> for everything. | +| git commit -m | `git commit -m ""` | Commit the staged snapshot, use to detail what is being committed. | +| git status | `git status` | List files that are staged, unstaged and untracked. | +| git log | `git log` | Display all commit history using the default format. There are additional options with this command. | +| git diff | `git diff` | Show unstaged changes between your index and working directory. | -### Git Undoing Changes +### Git Undoing Changes -| Command | Example | Description | -| --------------- | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| git revert | `git revert ` | Create a new commit that undoes all of the changes made in then apply it to the current branch. | -| git reset | `git reset ` | Remove from the staging area, but leave the working directory unchanged. This unstages a file without overwriting any changes. | -| git clean | `git clean -n` | Shows which files would be removed from the working directory. Use `-f` in place of `-n` to execute the clean. | + +| Command | Example | Description | +| ------------ | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | +| git revert | `git revert ` | Create a new commit that undoes all of the changes made in then apply it to the current branch. | +| git reset | `git reset ` | Remove from the staging area, but leave the working directory unchanged. This unstages a file without overwriting any changes. | +| git clean | `git clean -n` | Shows which files would be removed from the working directory. Use`-f` in place of `-n` to execute the clean. | ### Git Rewriting History -| Command | Example | Description | -| --------------- | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| git commit | `git commit --amend` | Replace the last commit with the staged changes and last commit combined. Use with nothing staged to edit the last commit’s message. | -| git rebase | `git rebase ` | Rebase the current branch onto . can be a commit ID, branch name, a tag, or a relative reference to HEAD. | -| git reflog | `git reflog` | Show a log of changes to the local repository’s HEAD. Add --relative-date flag to show date info or --all to show all refs. | + +| Command | Example | Description | +| ------------ | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | +| git commit | `git commit --amend` | Replace the last commit with the staged changes and last commit combined. Use with nothing staged to edit the last commit’s message. | +| git rebase | `git rebase ` | Rebase the current branch onto. can be a commit ID, branch name, a tag, or a relative reference to HEAD. | +| git reflog | `git reflog` | Show a log of changes to the local repository’s HEAD. Add --relative-date flag to show date info or --all to show all refs. | ### Git Branches -| Command | Example | Description | -| --------------- | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| git branch | `git branch` | List all of the branches in your repo. Add a argument to create a new branch with the name . | -| git checkout | `git checkout -b ` | Create and check out a new branch named . Drop the -b flag to checkout an existing branch. | -| git merge | `git merge ` | Merge into the current branch. | + +| Command | Example | Description | +| -------------- | ---------------------------- | -------------------------------------------------------------------------------------------------------------- | +| git branch | `git branch` | List all of the branches in your repo. Add a argument to create a new branch with the name . | +| git checkout | `git checkout -b ` | Create and check out a new branch named. Drop the -b flag to checkout an existing branch. | +| git merge | `git merge ` | Merge into the current branch. | ### Git Remote Repositories -| Command | Example | Description | -| --------------- | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| git remote add | `git remote add ` | Create a new connection to a remote repo. After adding a remote, you can use as a shortcut for in other commands. | -| git fetch | `git fetch ` | Fetches a specific , from the repo. Leave off to fetch all remote refs. | -| git pull | `git pull ` | Fetch the specified remote’s copy of current branch and immediately merge it into the local copy. | -| git push | `git push ` | Push the branch to , along with necessary commits and objects. Creates named branch in the remote repo if it doesn’t exist. | + +| Command | Example | Description | +| ---------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | +| git remote add | `git remote add ` | Create a new connection to a remote repo. After adding a remote, you can use as a shortcut for in other commands. | +| git fetch | `git fetch ` | Fetches a specific, from the repo. Leave off to fetch all remote refs. | +| git pull | `git pull ` | Fetch the specified remote’s copy of current branch and immediately merge it into the local copy. | +| git push | `git push ` | Push the branch to, along with necessary commits and objects. Creates named branch in the remote repo if it doesn’t exist. | ### Git Diff -| Command | Example | Description | -| --------------- | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| git diff HEAD | `git diff HEAD` | Show difference between working directory and last commit. | -| git diff --cached | `git diff --cached` | Show difference between staged changes and last commit | + +| Command | Example | Description | +| ------------------- | --------------------- | ------------------------------------------------------------ | +| git diff HEAD | `git diff HEAD` | Show difference between working directory and last commit. | +| git diff --cached | `git diff --cached` | Show difference between staged changes and last commit | ### Git Config -| Command | Example | Description | -| ----------------------------------------------------- | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | -| git config --global user.name | `git config --global user.name ` | Define the author name to be used for all commits by the current user. | -| git config --global user.email | `git config --global user.email ` | Define author email to be used for all commits by the current user. | -| git config --global alias | `git config --global alias ` | Create shortcut for a git command . | -| git config --system core.editor | `git config --system core.editor ` | Set the text editor to be used by commands for all users on the machine. arg should be the comamnd that launches the desired editor. | -| git config --global --edit | `git config --global --edit ` | Open the global configuration file in a text editor for manual editing. | + +| Command | Example | Description | +| ----------------------------------------------------- | -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| git config --global user.name | `git config --global user.name ` | Define the author name to be used for all commits by the current user. | +| git config --global user.email | `git config --global user.email ` | Define author email to be used for all commits by the current user. | +| git config --global alias | `git config --global alias ` | Create shortcut for a git command . | +| git config --system core.editor | `git config --system core.editor ` | Set the text editor to be used by commands for all users on the machine. arg should be the comamnd that launches the desired editor. | +| git config --global --edit | `git config --global --edit ` | Open the global configuration file in a text editor for manual editing. | ### Git Rebase -| Command | Example | Description | -| ------------------------------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- | -| git rebase -i | `git rebase -i ` | Interactively rebase current branch onto . Launches editor to enter commands for how each commit will be transferred to the new base. | + +| Command | Example | Description | +| --------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | +| git rebase -i | `git rebase -i ` | Interactively rebase current branch onto. Launches editor to enter commands for how each commit will be transferred to the new base. | ### Git Pull -| Command | Example | Description | -| ------------------------------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- | -| git pull --rebase | `git pull --rebase ` | Fetch the remote’s copy of current branch and rebases it into the local copy. Uses git rebase instead of merge to integrate the branches. | + +| Command | Example | Description | +| --------------------------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | +| git pull --rebase | `git pull --rebase ` | Fetch the remote’s copy of current branch and rebases it into the local copy. Uses git rebase instead of merge to integrate the branches. | ### Git Reset -| Command | Example | Description | -| ------------------------- | --------------------------| --------------------------------------------------------------------------------------------------------------------------------------------- | -| git reset | `git reset ` | Reset staging area to match most recent commit, but leave the working directory unchanged. | -| git reset --hard | `git reset --hard` | Reset staging area and working directory to match most recent commit and overwrites all changes in the working directory | -| git reset | `git reset ` | Move the current branch tip backward to , reset the staging area to match, but leave the working directory alone | -| git reset --hard | `git reset --hard ` | Same as previous, but resets both the staging area & working directory to match. Deletes uncommitted changes, and all commits after . | + +| Command | Example | Description | +| -------------------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| git reset | `git reset ` | Reset staging area to match most recent commit, but leave the working directory unchanged. | +| git reset --hard | `git reset --hard` | Reset staging area and working directory to match most recent commit and overwrites all changes in the working directory | +| git reset | `git reset ` | Move the current branch tip backward to, reset the staging area to match, but leave the working directory alone | +| git reset --hard | `git reset --hard ` | Same as previous, but resets both the staging area & working directory to match. Deletes uncommitted changes, and all commits after. | ### Git Push -| Command | Example | Description | -| ------------------------- | --------------------------| --------------------------------------------------------------------------------------------------------------------------------------------- | -| git push --force | `git push --force` | Forces the git push even if it results in a non-fast-forward merge. Do not use the --force flag unless you’re absolutely sure you know what you’re doing. | -| git push --all | `git push --all` | Push all of your local branches to the specified remote. | -| git push --tags | `git push --tags` | Tags aren’t automatically pushed when you push a branch or use the --all flag. The --tags flag sends all of your local tags to the remote repo. | -## Resources +| Command | Example | Description | +| -------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| git push --force | `git push --force` | Forces the git push even if it results in a non-fast-forward merge. Do not use the --force flag unless you’re absolutely sure you know what you’re doing. | +| git push --all | `git push --all` | Push all of your local branches to the specified remote. | +| git push --tags | `git push --tags` | Tags aren’t automatically pushed when you push a branch or use the --all flag. The --tags flag sends all of your local tags to the remote repo. | + +## Resources - [What is Version Control?](https://www.youtube.com/watch?v=Yc8sCSeMhi4) - [Types of Version Control System](https://www.youtube.com/watch?v=kr62e_n6QuQ) -- [Git Tutorial for Beginners](https://www.youtube.com/watch?v=8JJ101D3knE&t=52s) -- [Git for Professionals Tutorial](https://www.youtube.com/watch?v=Uszj_k0DGsg) -- [Git and GitHub for Beginners - Crash Course](https://www.youtube.com/watch?v=RGOj5yH7evk&t=8s) +- [Git Tutorial for Beginners](https://www.youtube.com/watch?v=8JJ101D3knE&t=52s) +- [Git for Professionals Tutorial](https://www.youtube.com/watch?v=Uszj_k0DGsg) +- [Git and GitHub for Beginners - Crash Course](https://www.youtube.com/watch?v=RGOj5yH7evk&t=8s) - [Complete Git and GitHub Tutorial](https://www.youtube.com/watch?v=apGV9Kg7ics) - [Git cheatsheet](https://www.atlassian.com/git/tutorials/atlassian-git-cheatsheet) - -See you on [Day 38](day38.md) +See you on [Day 38](day38.md) From 4f645663a224708ef8ab7c0721bd9de35945db60 Mon Sep 17 00:00:00 2001 From: subineru Date: Fri, 6 May 2022 23:26:55 +0800 Subject: [PATCH 2/7] day37(zh-tw) in-progress --- zh_tw/Days/day07.md | 2 +- zh_tw/Days/day37.md | 102 ++++++++++++++++++++++---------------------- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/zh_tw/Days/day07.md b/zh_tw/Days/day07.md index f7c3c26..fa32ed5 100644 --- a/zh_tw/Days/day07.md +++ b/zh_tw/Days/day07.md @@ -17,7 +17,7 @@ To be successful in DevOps you have to have a good knowledge of programming skil ## Understand why you need to learn a programming language. -The reason that Python and Go are recommended so often for DevOps engineers is that a lot of the DevOps tooling is written in either Python or Go, which makes sense if you are going be build DevOps tools. Now this is important as this will determine really what you should learn and that would likely be the most beneficial. If you are going to be building DevOps tools or you are joining a team that does then it would make sense to learn that same language, if you are going to be heavily involved in Kubernetes or Containers then it's more than likely that you would want to choose Go as your programming language. For me, the company I work for (Kasten by Veeam) is in the Cloud-Native ecosystem focused on data management for Kubernetes and everything is written in Go. +The reason that Python and Go are recommended so often for DevOps engineers is that a lot of the DevOps tooling is written in either Python or Go, which makes sense if you are going to be building DevOps tools. Now this is important as this will determine really what you should learn and that would likely be the most beneficial. If you are going to be building DevOps tools or you are joining a team that does then it would make sense to learn that same language, if you are going to be heavily involved in Kubernetes or Containers then it's more than likely that you would want to choose Go as your programming language. For me, the company I work for (Kasten by Veeam) is in the Cloud-Native ecosystem focused on data management for Kubernetes and everything is written in Go. But then you might not have clear cut reasoning like that to choose you might be a student or transitioning careers with no real decision made for you. I think in this situation then you should choose the one that seems to resonate and fit with the applications you are looking to work with. diff --git a/zh_tw/Days/day37.md b/zh_tw/Days/day37.md index fb2a0e1..b846eb4 100644 --- a/zh_tw/Days/day37.md +++ b/zh_tw/Days/day37.md @@ -9,88 +9,88 @@ id: 1048707 --- ## Git 入門 -本篇的作者在這裡很有趣玩諧音梗,把英文的 Getting to know Git改寫成 Gitting to know Git。 +本篇的作者在這裡很有趣玩諧音梗,把英文的 Getting to know Git 改寫成 Gitting to know Git。 -在前兩篇文章中我們學習了有關版本控制,[第35天](day35.md) and some of the fundamental workflows of git as a version control system [ Then we got git installed on our system, updated and configured. We also went a little deeper on the theory between Client-Server version control system and Git which is a distributed version control system [Day 36](day36.md). +在前兩篇文章中我們學習了有關版本控制,[第35天](day35.md)講到了Git做為一個版本控制系統有哪些基本的工作流程。[第36天](day36.md)講到如何安裝、更新和設定,更稍微深入探討主從式和分佈式版本控制系統 Git 之間的理論。 -Now we are going to run through some of the commands and use cases that we will all commonly see with git. +現在,我們將迅速帶過在 Git 常見的指令和使用案例。 -### Where to git help with git? +### 何處取得Git文件? -There is going to be times where you just cannot remember or just don't know the command you need to get things done with git. You are going to need help. +有時候你會忘記或是不曉得要用什麼 Git 指令來達到你要的需求。這時候你會需要幫助。 -It goes without saying that google or any search engine is likely to be your first port of call when searching help. +不用說通常大家都會優先用Google和任何的搜尋引擎來尋找你要的答案。 -Secondly the next place is going to be the official git site and the documentation. [git-scm.com/docs](http://git-scm.com/docs) Here you will find not only a solid reference to all the commands available but also lots of different resources. +第二種方法是你也可以到 Git 官方網站取得文件說明。 [git-scm.com/docs](http://git-scm.com/docs) 鏈結不僅可以找到所有命令的參考資訊,還能找到不同的資源(如下圖)。 ![](Images/Day37_Git1.png) -We can also access this same documentation which is super useful if you are without connectivity from the terminal. If we chose the `git add` command for example we can run `git add --help` and we see below the manual. +從終端機上也可以找到跟 Git 官方網站相同的說明。如果我們要用指令`git add`,但是不確定使用方式時就能夠輸入`git add --help`來取得說明。 ![](Images/Day37_Git2.png) -We can also in the shell use `git add -h` which is going to give us a short summary of the options we have available. +我們也可以輸入指令`git add -h`來取得較簡短的說明。 ![](Images/Day37_Git3.png) ### 圍繞在 Git 的神話 -"Git has no access control" - You can empower a leader to maintain source code. +"Git 沒有授權控制" - 所以你可以授權領導者維護原始碼。 -"Git 太肥 - Git has the ability to provide shallow repositories which basically means a reduced amount of history if you have large projects. +"Git 太肥" - 如果你有大型的專案,Git 有能力提供淺層儲存庫,基本上這意味著它能夠減少歷史的紀錄。 ### 真正的缺點 -對二進位檔案來說並不適合。Git適合用在原始碼,但如果是執行檔或影片這些例子就不適用。 +不適合用在二進位檔案。Git 適合用在原始碼,但如果是執行檔或影片就不建議。 -Git 對使用的人並不友善,事實上我們必須花費時間討論命令和功能。 the fact that we have to spend time talking about commands and functions of the tool is probably a key sign of that. +Git 對使用的人並不友善,事實上我們必須花費時間討論命令和功能怎麼使用。 -整理來說,Git 困難但易用。 +整理來說,Git 難學好用。 ### Git 生態系統 -I want to briefly cover the ecosystem around git but not deep dive into some of these areas but I think its important to note these here at a high level. +我想要從宏觀的角度來介紹環繞在 Git 間的生態系統,但是我不會深入探討其中的一些領域。 -Almost all modern development tools support Git. +幾乎所有的開發工具都支援 Git。 -- Developer tools - We have already mentioned visual studio code but you will find git plugins and integrations into sublime text and other text editors and IDEs. -- Team tools - Also mentioned around tools like Jenkins from a CI/CD point of view, Slack from a messaging framework and Jira for project management and issue tracking. -- Cloud Providers - All the large cloud providers support git, Microsoft Azure, Amazon AWS, Google Cloud Platform. -- Git-Based services - Then we have the GitHub, GitLab and BitBucket of which we will cover in more detail later on. I have heard these services as the social network for code! +- 開發工具 - 我們曾經提到微軟的 visual studio code 有支援,其他的文字編輯器像是 sublime text 也有提供外掛整合 Git。 +- 團隊工具 - 用來做持續整合/持續佈署的 Jekins, Slack 的訊息框架和專案管理/問題追蹤系統 Jira。 +- 雲端供應商 - 所有的雲端供應商都有支援 Git,Microsoft Azure、Amazon AWS、Google Cloud Platform。 +- 基於Git的服務 - GitHub、GitLab 和 BitBucket 之後會有更詳盡的探討。我聽過這些服務是程式碼的社交網路! -### Git 備忘紙條 +### Git Cheatsheet -We have not covered most of these commands but having looked at some cheatsheets available online I wanted to document some of the git commands and what their purpose are. We don't need to remember these all, and with more hands on practice and using you will pick at least the git basics. +我們沒有列出大部分可用的指令,看過一些線上的 Git cheatsheets之後,我紀錄一些指令和其目的。你並不需要記下所有的指令,你只要頻繁的使用自然而然就會記得。 -I have taken these from [atlassian](https://www.atlassian.com/git/tutorials/atlassian-git-cheatsheet) but writing them down and reading the description is a good way to get to know what the commands are as well as getting hands on in every day tasks. +我從 [atlassian](https://www.atlassian.com/git/tutorials/atlassian-git-cheatsheet) 連結抄寫上面的指令和說明,就像是每天親身參與的日常任務,這也是了解 Git 指令的一種好方法。 -### Git Basics +### Git 基本操作 -| Command | Example | Description | -| --------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | -| git init | `git init ` | Create an empty git repository in specified directory. | -| git clone | `git clone ` | Clone repository located at onto local machine. | -| git config | `git config user.name` | Define author name to be used for all commits in current repository`system`, `global`, `local` flag to set config options. | -| git add | `git add ` | Stage all changes in for the next commit. We can also add and <.> for everything. | -| git commit -m | `git commit -m ""` | Commit the staged snapshot, use to detail what is being committed. | -| git status | `git status` | List files that are staged, unstaged and untracked. | -| git log | `git log` | Display all commit history using the default format. There are additional options with this command. | -| git diff | `git diff` | Show unstaged changes between your index and working directory. | +| 指令 | 範例 | 描述 | +| --------------- | ----------------------------- | ----------------------------------------------------------------------------------- | +| git init | `git init ` | 在指定的資料夾上建立一個空的 Git 儲存庫。 | +| git clone | `git clone ` | 將遠端的儲存庫複製到自己的電腦上。 | +| git config | `git config user.name` | 為目前的儲存庫定義每次提交時用的作者名,可增加配置選項`system`、`global`、`local` | +| git add | `git add ` | 將檔案或目錄加入索引。也可以輸入 <.> 索引所有的檔案。 | +| git commit -m | `git commit -m ""` | 將索引的檔案提交出去,-m 加入註解。 | +| git status | `git status` | 列出那些檔案已索引、未索引、未追蹤。 | +| git log | `git log` | 用預設格式列出所有提交的歷史紀錄,這個指令有其他選項可用。 | +| git diff | `git diff` | 列出你的工作目錄和索引之間有何差異。 | ### Git Undoing Changes -| Command | Example | Description | +| 指令 | 範例 | 描述 | | ------------ | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -| git revert | `git revert ` | Create a new commit that undoes all of the changes made in then apply it to the current branch. | +| git revert | `git revert ` | 做反向處理,回復這次提交的異動,並建立新的提供。 | | git reset | `git reset ` | Remove from the staging area, but leave the working directory unchanged. This unstages a file without overwriting any changes. | -| git clean | `git clean -n` | Shows which files would be removed from the working directory. Use`-f` in place of `-n` to execute the clean. | +| git clean | `git clean -n` | 列出那些檔案會從你的工作目錄刪除。`-n`改成`-f`就會真正執行刪除。 | ### Git Rewriting History -| Command | Example | Description | +| 指令 | 範例 | 描述 | | ------------ | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | | git commit | `git commit --amend` | Replace the last commit with the staged changes and last commit combined. Use with nothing staged to edit the last commit’s message. | | git rebase | `git rebase ` | Rebase the current branch onto. can be a commit ID, branch name, a tag, or a relative reference to HEAD. | @@ -99,7 +99,7 @@ I have taken these from [atlassian](https://www.atlassian.com/git/tutorials/atla ### Git Branches -| Command | Example | Description | +| 指令 | 範例 | 描述 | | -------------- | ---------------------------- | -------------------------------------------------------------------------------------------------------------- | | git branch | `git branch` | List all of the branches in your repo. Add a argument to create a new branch with the name . | | git checkout | `git checkout -b ` | Create and check out a new branch named. Drop the -b flag to checkout an existing branch. | @@ -108,7 +108,7 @@ I have taken these from [atlassian](https://www.atlassian.com/git/tutorials/atla ### Git Remote Repositories -| Command | Example | Description | +| 指令 | 範例 | 描述 | | ---------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | | git remote add | `git remote add ` | Create a new connection to a remote repo. After adding a remote, you can use as a shortcut for in other commands. | | git fetch | `git fetch ` | Fetches a specific, from the repo. Leave off to fetch all remote refs. | @@ -118,7 +118,7 @@ I have taken these from [atlassian](https://www.atlassian.com/git/tutorials/atla ### Git Diff -| Command | Example | Description | +| 指令 | 範例 | 描述 | | ------------------- | --------------------- | ------------------------------------------------------------ | | git diff HEAD | `git diff HEAD` | Show difference between working directory and last commit. | | git diff --cached | `git diff --cached` | Show difference between staged changes and last commit | @@ -126,7 +126,7 @@ I have taken these from [atlassian](https://www.atlassian.com/git/tutorials/atla ### Git Config -| Command | Example | Description | +| 指令 | 範例 | 描述 | | ----------------------------------------------------- | -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | git config --global user.name | `git config --global user.name ` | Define the author name to be used for all commits by the current user. | | git config --global user.email | `git config --global user.email ` | Define author email to be used for all commits by the current user. | @@ -137,21 +137,21 @@ I have taken these from [atlassian](https://www.atlassian.com/git/tutorials/atla ### Git Rebase -| Command | Example | Description | +| 指令 | 範例 | 描述 | | --------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | | git rebase -i | `git rebase -i ` | Interactively rebase current branch onto. Launches editor to enter commands for how each commit will be transferred to the new base. | ### Git Pull -| Command | Example | Description | +| 指令 | 範例 | 描述 | | --------------------------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | | git pull --rebase | `git pull --rebase ` | Fetch the remote’s copy of current branch and rebases it into the local copy. Uses git rebase instead of merge to integrate the branches. | ### Git Reset -| Command | Example | Description | +| 指令 | 範例 | 描述 | | -------------------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | git reset | `git reset ` | Reset staging area to match most recent commit, but leave the working directory unchanged. | | git reset --hard | `git reset --hard` | Reset staging area and working directory to match most recent commit and overwrites all changes in the working directory | @@ -161,11 +161,11 @@ I have taken these from [atlassian](https://www.atlassian.com/git/tutorials/atla ### Git Push -| Command | Example | Description | -| -------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| git push --force | `git push --force` | Forces the git push even if it results in a non-fast-forward merge. Do not use the --force flag unless you’re absolutely sure you know what you’re doing. | -| git push --all | `git push --all` | Push all of your local branches to the specified remote. | -| git push --tags | `git push --tags` | Tags aren’t automatically pushed when you push a branch or use the --all flag. The --tags flag sends all of your local tags to the remote repo. | +| 指令 | 範例 | Description | +| -------------------------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------- | +| git push --force | `git push --force` | 強迫推送即使會發生 non-fast-forward。不要用 --force 選項,除非你很清楚自己在做什麼。 | +| git push --all | `git push --all` | 將本地的分支推送到指令的遠端伺服器。 | +| git push --tags | `git push --tags` | push 或加上 --all 選項,預設不會傳送標籤到遠端伺服器。加上 --tags 選項才會將本地的標籤推送到遠端儲存庫。 | ## Resources @@ -177,4 +177,4 @@ I have taken these from [atlassian](https://www.atlassian.com/git/tutorials/atla - [Complete Git and GitHub Tutorial](https://www.youtube.com/watch?v=apGV9Kg7ics) - [Git cheatsheet](https://www.atlassian.com/git/tutorials/atlassian-git-cheatsheet) -See you on [Day 38](day38.md) +See you on [第 38 天](day38.md) From c3d820b6ed788ef507694d5dbb3f875f884f2cad Mon Sep 17 00:00:00 2001 From: subineru Date: Fri, 6 May 2022 23:39:26 +0800 Subject: [PATCH 3/7] day37(zh-tw) in progress v2 --- zh_tw/Days/day37.md | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/zh_tw/Days/day37.md b/zh_tw/Days/day37.md index b846eb4..35a3c4b 100644 --- a/zh_tw/Days/day37.md +++ b/zh_tw/Days/day37.md @@ -54,8 +54,11 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 幾乎所有的開發工具都支援 Git。 - 開發工具 - 我們曾經提到微軟的 visual studio code 有支援,其他的文字編輯器像是 sublime text 也有提供外掛整合 Git。 + - 團隊工具 - 用來做持續整合/持續佈署的 Jekins, Slack 的訊息框架和專案管理/問題追蹤系統 Jira。 + - 雲端供應商 - 所有的雲端供應商都有支援 Git,Microsoft Azure、Amazon AWS、Google Cloud Platform。 + - 基於Git的服務 - GitHub、GitLab 和 BitBucket 之後會有更詳盡的探討。我聽過這些服務是程式碼的社交網路! ### Git Cheatsheet @@ -66,7 +69,6 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git 基本操作 - | 指令 | 範例 | 描述 | | --------------- | ----------------------------- | ----------------------------------------------------------------------------------- | | git init | `git init ` | 在指定的資料夾上建立一個空的 Git 儲存庫。 | @@ -80,7 +82,6 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Undoing Changes - | 指令 | 範例 | 描述 | | ------------ | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | | git revert | `git revert ` | 做反向處理,回復這次提交的異動,並建立新的提供。 | @@ -89,7 +90,6 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Rewriting History - | 指令 | 範例 | 描述 | | ------------ | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | | git commit | `git commit --amend` | Replace the last commit with the staged changes and last commit combined. Use with nothing staged to edit the last commit’s message. | @@ -98,7 +98,6 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Branches - | 指令 | 範例 | 描述 | | -------------- | ---------------------------- | -------------------------------------------------------------------------------------------------------------- | | git branch | `git branch` | List all of the branches in your repo. Add a argument to create a new branch with the name . | @@ -107,7 +106,6 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Remote Repositories - | 指令 | 範例 | 描述 | | ---------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | | git remote add | `git remote add ` | Create a new connection to a remote repo. After adding a remote, you can use as a shortcut for in other commands. | @@ -117,7 +115,6 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Diff - | 指令 | 範例 | 描述 | | ------------------- | --------------------- | ------------------------------------------------------------ | | git diff HEAD | `git diff HEAD` | Show difference between working directory and last commit. | @@ -125,7 +122,6 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Config - | 指令 | 範例 | 描述 | | ----------------------------------------------------- | -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | git config --global user.name | `git config --global user.name ` | Define the author name to be used for all commits by the current user. | @@ -136,21 +132,18 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Rebase - | 指令 | 範例 | 描述 | | --------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | | git rebase -i | `git rebase -i ` | Interactively rebase current branch onto. Launches editor to enter commands for how each commit will be transferred to the new base. | ### Git Pull - | 指令 | 範例 | 描述 | | --------------------------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | | git pull --rebase | `git pull --rebase ` | Fetch the remote’s copy of current branch and rebases it into the local copy. Uses git rebase instead of merge to integrate the branches. | ### Git Reset - | 指令 | 範例 | 描述 | | -------------------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | git reset | `git reset ` | Reset staging area to match most recent commit, but leave the working directory unchanged. | @@ -160,7 +153,6 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Push - | 指令 | 範例 | Description | | -------------------------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------- | | git push --force | `git push --force` | 強迫推送即使會發生 non-fast-forward。不要用 --force 選項,除非你很清楚自己在做什麼。 | @@ -177,4 +169,5 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 - [Complete Git and GitHub Tutorial](https://www.youtube.com/watch?v=apGV9Kg7ics) - [Git cheatsheet](https://www.atlassian.com/git/tutorials/atlassian-git-cheatsheet) -See you on [第 38 天](day38.md) + +See you on [第 38 天](day38.md) \ No newline at end of file From 8eecf94765942cfc47c3589c45176d41e6ce5237 Mon Sep 17 00:00:00 2001 From: subineru Date: Sat, 7 May 2022 00:48:11 +0800 Subject: [PATCH 4/7] day37(zh-tw) in progress --- zh_tw/Days/day37.md | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/zh_tw/Days/day37.md b/zh_tw/Days/day37.md index 35a3c4b..4913e2e 100644 --- a/zh_tw/Days/day37.md +++ b/zh_tw/Days/day37.md @@ -9,9 +9,9 @@ id: 1048707 --- ## Git 入門 -本篇的作者在這裡很有趣玩諧音梗,把英文的 Getting to know Git 改寫成 Gitting to know Git。 +本篇的作者在這裡玩了個諧音梗,把英文的 Getting to know Git 改寫成 Gitting to know Git。 -在前兩篇文章中我們學習了有關版本控制,[第35天](day35.md)講到了Git做為一個版本控制系統有哪些基本的工作流程。[第36天](day36.md)講到如何安裝、更新和設定,更稍微深入探討主從式和分佈式版本控制系統 Git 之間的理論。 +在前兩篇文章中我們學習了有關版本控制,[第35天](day35.md)講到 Git 做為一個版本控制系統有哪些基本的工作流程。[第36天](day36.md)講到如何安裝、更新和設定,更稍微深入探討主從式和分佈式版本控制系統 Git 之間的理論。 現在,我們將迅速帶過在 Git 常見的指令和使用案例。 @@ -54,11 +54,8 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 幾乎所有的開發工具都支援 Git。 - 開發工具 - 我們曾經提到微軟的 visual studio code 有支援,其他的文字編輯器像是 sublime text 也有提供外掛整合 Git。 - - 團隊工具 - 用來做持續整合/持續佈署的 Jekins, Slack 的訊息框架和專案管理/問題追蹤系統 Jira。 - - 雲端供應商 - 所有的雲端供應商都有支援 Git,Microsoft Azure、Amazon AWS、Google Cloud Platform。 - - 基於Git的服務 - GitHub、GitLab 和 BitBucket 之後會有更詳盡的探討。我聽過這些服務是程式碼的社交網路! ### Git Cheatsheet @@ -69,6 +66,7 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git 基本操作 + | 指令 | 範例 | 描述 | | --------------- | ----------------------------- | ----------------------------------------------------------------------------------- | | git init | `git init ` | 在指定的資料夾上建立一個空的 Git 儲存庫。 | @@ -82,6 +80,7 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Undoing Changes + | 指令 | 範例 | 描述 | | ------------ | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | | git revert | `git revert ` | 做反向處理,回復這次提交的異動,並建立新的提供。 | @@ -90,6 +89,7 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Rewriting History + | 指令 | 範例 | 描述 | | ------------ | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | | git commit | `git commit --amend` | Replace the last commit with the staged changes and last commit combined. Use with nothing staged to edit the last commit’s message. | @@ -98,6 +98,7 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Branches + | 指令 | 範例 | 描述 | | -------------- | ---------------------------- | -------------------------------------------------------------------------------------------------------------- | | git branch | `git branch` | List all of the branches in your repo. Add a argument to create a new branch with the name . | @@ -106,6 +107,7 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Remote Repositories + | 指令 | 範例 | 描述 | | ---------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | | git remote add | `git remote add ` | Create a new connection to a remote repo. After adding a remote, you can use as a shortcut for in other commands. | @@ -115,6 +117,7 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Diff + | 指令 | 範例 | 描述 | | ------------------- | --------------------- | ------------------------------------------------------------ | | git diff HEAD | `git diff HEAD` | Show difference between working directory and last commit. | @@ -122,6 +125,7 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Config + | 指令 | 範例 | 描述 | | ----------------------------------------------------- | -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | git config --global user.name | `git config --global user.name ` | Define the author name to be used for all commits by the current user. | @@ -132,18 +136,21 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Rebase + | 指令 | 範例 | 描述 | | --------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | | git rebase -i | `git rebase -i ` | Interactively rebase current branch onto. Launches editor to enter commands for how each commit will be transferred to the new base. | ### Git Pull + | 指令 | 範例 | 描述 | | --------------------------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | | git pull --rebase | `git pull --rebase ` | Fetch the remote’s copy of current branch and rebases it into the local copy. Uses git rebase instead of merge to integrate the branches. | ### Git Reset + | 指令 | 範例 | 描述 | | -------------------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | git reset | `git reset ` | Reset staging area to match most recent commit, but leave the working directory unchanged. | @@ -153,6 +160,7 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Push + | 指令 | 範例 | Description | | -------------------------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------- | | git push --force | `git push --force` | 強迫推送即使會發生 non-fast-forward。不要用 --force 選項,除非你很清楚自己在做什麼。 | @@ -169,5 +177,4 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 - [Complete Git and GitHub Tutorial](https://www.youtube.com/watch?v=apGV9Kg7ics) - [Git cheatsheet](https://www.atlassian.com/git/tutorials/atlassian-git-cheatsheet) - -See you on [第 38 天](day38.md) \ No newline at end of file +See you on [第 38 天](day38.md) From 4f2553ba821b9dd7463dd7c491bac6e8954ce655 Mon Sep 17 00:00:00 2001 From: subineru Date: Sat, 7 May 2022 11:40:47 +0800 Subject: [PATCH 5/7] day37(zh-tw) in progress --- zh_tw/Days/day37.md | 64 ++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/zh_tw/Days/day37.md b/zh_tw/Days/day37.md index 4913e2e..8e71301 100644 --- a/zh_tw/Days/day37.md +++ b/zh_tw/Days/day37.md @@ -11,7 +11,7 @@ id: 1048707 本篇的作者在這裡玩了個諧音梗,把英文的 Getting to know Git 改寫成 Gitting to know Git。 -在前兩篇文章中我們學習了有關版本控制,[第35天](day35.md)講到 Git 做為一個版本控制系統有哪些基本的工作流程。[第36天](day36.md)講到如何安裝、更新和設定,更稍微深入探討主從式和分佈式版本控制系統 Git 之間的理論。 +在前兩篇文章中我們學習了有關版本控制,[第35天](day35.md)講到 Git 做為一個版本控制系統具有哪些基本的工作流程。[第36天](day36.md)講到如何安裝、更新和設定,更稍稍地深入探討主從式和分佈式版本控制系統 Git 之間的理論。 現在,我們將迅速帶過在 Git 常見的指令和使用案例。 @@ -19,29 +19,29 @@ id: 1048707 有時候你會忘記或是不曉得要用什麼 Git 指令來達到你要的需求。這時候你會需要幫助。 -不用說通常大家都會優先用Google和任何的搜尋引擎來尋找你要的答案。 +不用說通常大家都會優先用 Google 或任何的搜尋引擎尋找你要的答案。 -第二種方法是你也可以到 Git 官方網站取得文件說明。 [git-scm.com/docs](http://git-scm.com/docs) 鏈結不僅可以找到所有命令的參考資訊,還能找到不同的資源(如下圖)。 +第二種方法是你也能到 Git 官方網站取得文件說明。 [git-scm.com/docs](http://git-scm.com/docs) 連結裡不僅可以找到所有命令的參考資訊,還能找到不同的資源(如下圖)。 ![](Images/Day37_Git1.png) -從終端機上也可以找到跟 Git 官方網站相同的說明。如果我們要用指令`git add`,但是不確定使用方式時就能夠輸入`git add --help`來取得說明。 +從終端機上也有跟 Git 官方網站相同的說明。如果我們要用指令`git add`,但是不確定使用方式時就能夠輸入`git add --help`來取得說明。 ![](Images/Day37_Git2.png) -我們也可以輸入指令`git add -h`來取得較簡短的說明。 +我們也可以輸入指令`git add -h`來取得簡潔的說明。 ![](Images/Day37_Git3.png) ### 圍繞在 Git 的神話 -"Git 沒有授權控制" - 所以你可以授權領導者維護原始碼。 +"Git 沒有存取控制功能" - 但你可以授權一名領導者維護原始碼。 "Git 太肥" - 如果你有大型的專案,Git 有能力提供淺層儲存庫,基本上這意味著它能夠減少歷史的紀錄。 ### 真正的缺點 -不適合用在二進位檔案。Git 適合用在原始碼,但如果是執行檔或影片就不建議。 +不適合用在二進位檔案。Git 適合用在原始碼,如果是執行檔或影片就不建議。 Git 對使用的人並不友善,事實上我們必須花費時間討論命令和功能怎麼使用。 @@ -81,29 +81,29 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Undoing Changes -| 指令 | 範例 | 描述 | -| ------------ | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -| git revert | `git revert ` | 做反向處理,回復這次提交的異動,並建立新的提供。 | -| git reset | `git reset ` | Remove from the staging area, but leave the working directory unchanged. This unstages a file without overwriting any changes. | -| git clean | `git clean -n` | 列出那些檔案會從你的工作目錄刪除。`-n`改成`-f`就會真正執行刪除。 | +| 指令 | 範例 | 描述 | +| ------------ | ----------------------- | ------------------------------------------------------------------------------------------- | +| git revert | `git revert ` | 進行反向處理,回復該次提交的異動,並建立新的提交。 | +| git reset | `git reset ` | 還原暫存區到最近提交的版本,但是不變動工作目錄的檔案。 這將會取消暫存文件而不做任何覆蓋。 | +| git clean | `git clean -n` | 列出那些檔案會從你的工作目錄刪除。`-n`改成`-f`就會真正執行刪除。 | ### Git Rewriting History -| 指令 | 範例 | 描述 | -| ------------ | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -| git commit | `git commit --amend` | Replace the last commit with the staged changes and last commit combined. Use with nothing staged to edit the last commit’s message. | -| git rebase | `git rebase ` | Rebase the current branch onto. can be a commit ID, branch name, a tag, or a relative reference to HEAD. | -| git reflog | `git reflog` | Show a log of changes to the local repository’s HEAD. Add --relative-date flag to show date info or --all to show all refs. | +| 指令 | 範例 | 描述 | +| ------------ | ---------------------- | ------------------------------------------------------------------------------------------------------------------- | +| git commit | `git commit --amend` | 將變更過的暫存區和最後的提交合併後取代最後一次的提交。 如果暫存區沒有變更就可以修改註解。 | +| git rebase | `git rebase ` | 重新定義現在的分支,將其它分支當作現在分支的基礎,目標可以是一個 ID、分支名稱、一個標籤或一個 HEAD 的相對參考點。 | +| git reflog | `git reflog` | 顯示本機儲存庫HEAD變動的歷史紀錄。加配置選項 --relative-date 可以顯示日期,加 --all 顯示所有的參照. | ### Git Branches -| 指令 | 範例 | 描述 | -| -------------- | ---------------------------- | -------------------------------------------------------------------------------------------------------------- | -| git branch | `git branch` | List all of the branches in your repo. Add a argument to create a new branch with the name . | -| git checkout | `git checkout -b ` | Create and check out a new branch named. Drop the -b flag to checkout an existing branch. | -| git merge | `git merge ` | Merge into the current branch. | +| 指令 | 範例 | 描述 | +| -------------- | ---------------------------- | --------------------------------------------------------------- | +| git branch | `git branch` | 列出儲存庫上所有的分支。再加一個變數名字則可以建立新分支。 | +| git checkout | `git checkout -b ` | 創建一個新的分支。 移除參數 -b 則用來切換一支已經存在的分支。 | +| git merge | `git merge ` | 合併到現在的分支。 | ### Git Remote Repositories @@ -118,10 +118,10 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Diff -| 指令 | 範例 | 描述 | -| ------------------- | --------------------- | ------------------------------------------------------------ | -| git diff HEAD | `git diff HEAD` | Show difference between working directory and last commit. | -| git diff --cached | `git diff --cached` | Show difference between staged changes and last commit | +| 指令 | 範例 | 描述 | +| ------------------- | --------------------- | ---------------------------------------- | +| git diff HEAD | `git diff HEAD` | 比對最新的提交和工作目錄內的檔案內容。 | +| git diff --cached | `git diff --cached` | 比對最新的提交和索引內的檔案內容。 | ### Git Config @@ -151,12 +151,12 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Reset -| 指令 | 範例 | 描述 | -| -------------------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| git reset | `git reset ` | Reset staging area to match most recent commit, but leave the working directory unchanged. | -| git reset --hard | `git reset --hard` | Reset staging area and working directory to match most recent commit and overwrites all changes in the working directory | -| git reset | `git reset ` | Move the current branch tip backward to, reset the staging area to match, but leave the working directory alone | -| git reset --hard | `git reset --hard ` | Same as previous, but resets both the staging area & working directory to match. Deletes uncommitted changes, and all commits after. | +| 指令 | 範例 | 描述 | +| -------------------------- | ----------------------------- | -------------------------------------------------------------------------- | +| git reset | `git reset ` | 還原暫存區到最近提交的版本,但是不變動工作目錄的檔案。 | +| git reset --hard | `git reset --hard` | 還原暫存區和工作目錄到最新提交的版本,即使工作目錄有變更也會還原。 | +| git reset | `git reset ` | 還原暫存區到指定的版本,但是不變動工作目錄的檔案。 | +| git reset --hard | `git reset --hard ` | 還原暫存區和工作目錄到指定的版本。刪除未提交的更改,以及之後的所有提交。 | ### Git Push From e3e0c51a4b43397ff278f9c5c8a49f8af190b2a3 Mon Sep 17 00:00:00 2001 From: subi Date: Sat, 7 May 2022 16:39:39 +0800 Subject: [PATCH 6/7] day35 translation --- zh_tw/Days/day37.md | 48 ++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/zh_tw/Days/day37.md b/zh_tw/Days/day37.md index 8e71301..853732b 100644 --- a/zh_tw/Days/day37.md +++ b/zh_tw/Days/day37.md @@ -90,11 +90,11 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Rewriting History -| 指令 | 範例 | 描述 | -| ------------ | ---------------------- | ------------------------------------------------------------------------------------------------------------------- | -| git commit | `git commit --amend` | 將變更過的暫存區和最後的提交合併後取代最後一次的提交。 如果暫存區沒有變更就可以修改註解。 | -| git rebase | `git rebase ` | 重新定義現在的分支,將其它分支當作現在分支的基礎,目標可以是一個 ID、分支名稱、一個標籤或一個 HEAD 的相對參考點。 | -| git reflog | `git reflog` | 顯示本機儲存庫HEAD變動的歷史紀錄。加配置選項 --relative-date 可以顯示日期,加 --all 顯示所有的參照. | +| 指令 | 範例 | 描述 | +| ------------ | ---------------------- | --------------------------------------------------------------------------------------------------------------- | +| git commit | `git commit --amend` | 將變更過的暫存區和最後的提交合併後取代最後一次的提交。 如果暫存區沒有變更就可以修改註解。 | +| git rebase | `git rebase ` | 重新定義現在的分支,將現在分支嫁接到其他分支,目標可以是一個 ID、分支名稱、一個標籤或一個 HEAD 的相對參考點。 | +| git reflog | `git reflog` | 顯示本機儲存庫HEAD變動的歷史紀錄。加配置選項 --relative-date 可以顯示日期,加 --all 顯示所有的參照. | ### Git Branches @@ -108,12 +108,12 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Remote Repositories -| 指令 | 範例 | 描述 | -| ---------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | -| git remote add | `git remote add ` | Create a new connection to a remote repo. After adding a remote, you can use as a shortcut for in other commands. | -| git fetch | `git fetch ` | Fetches a specific, from the repo. Leave off to fetch all remote refs. | -| git pull | `git pull ` | Fetch the specified remote’s copy of current branch and immediately merge it into the local copy. | -| git push | `git push ` | Push the branch to, along with necessary commits and objects. Creates named branch in the remote repo if it doesn’t exist. | +| 指令 | 範例 | 描述 | +| ---------------- | ------------------------------- | ------------------------------------------------------------------------------ | +| git remote add | `git remote add ` | 為遠端的倉儲庫建立簡稱,方便之後進行推送。 | +| git fetch | `git fetch ` | 取回指定分支的更新。如果沒有指定則取回所有的更新到索引,工作目錄不會被更動。 | +| git pull | `git pull ` | 取回指定分支的更新,並且立即更新工作目錄上的檔案。 | +| git push | `git push ` | 將你提交的檔案推送到遠端。如果遠端不存在推送的分支,將會建立新的分支。 | ### Git Diff @@ -126,27 +126,27 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Config -| 指令 | 範例 | 描述 | -| ----------------------------------------------------- | -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| git config --global user.name | `git config --global user.name ` | Define the author name to be used for all commits by the current user. | -| git config --global user.email | `git config --global user.email ` | Define author email to be used for all commits by the current user. | -| git config --global alias | `git config --global alias ` | Create shortcut for a git command . | -| git config --system core.editor | `git config --system core.editor ` | Set the text editor to be used by commands for all users on the machine. arg should be the comamnd that launches the desired editor. | -| git config --global --edit | `git config --global --edit ` | Open the global configuration file in a text editor for manual editing. | +| 指令 | 範例 | 描述 | +| ----------------------------------------------------- | -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| git config --global user.name | `git config --global user.name ` | 為系統現在登入的帳號定義每次使用 Git 提交時所用的作者名。 | +| git config --global user.email | `git config --global user.email ` | 為系統現在登入的帳號定義每次使用 Git 提交時所用的信箱。 | +| git config --global alias | `git config --global alias ` | 幫 Git 指令建立簡稱。 | +| git config --system core.editor | `git config --system core.editor ` | 為所有的系統帳戶設定 Git 預設的文字編輯器,當 Git 需要輸入訊息的時候會用到。 參數應該指向系統有的文字編輯器。 | +| git config --global --edit | `git config --global --edit ` | 用文件編輯器開啟全域的 Git 設定檔。 | ### Git Rebase -| 指令 | 範例 | 描述 | -| --------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | -| git rebase -i | `git rebase -i ` | Interactively rebase current branch onto. Launches editor to enter commands for how each commit will be transferred to the new base. | +| 指令 | 範例 | 描述 | +| --------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------ | +| git rebase -i | `git rebase -i ` | 用非互動的方式將現在的分支嫁接到其他分支。另外啟動文字編輯器提供輸入每次提交時如何轉移到新的分支上。 | ### Git Pull -| 指令 | 範例 | 描述 | -| --------------------------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | -| git pull --rebase | `git pull --rebase ` | Fetch the remote’s copy of current branch and rebases it into the local copy. Uses git rebase instead of merge to integrate the branches. | +| 指令 | 範例 | 描述 | +| --------------------------- | ------------------------------ | ------------------------------------------------ | +| git pull --rebase | `git pull --rebase ` | 抓取放在遠端的分支並且嫁接在現在的工作目錄上。 | ### Git Reset From 39f5d041cfec0a5daa2df3a7a5e797863bd772da Mon Sep 17 00:00:00 2001 From: subi Date: Sat, 7 May 2022 16:44:15 +0800 Subject: [PATCH 7/7] day35 translation --- zh_tw/Days/day37.md | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/zh_tw/Days/day37.md b/zh_tw/Days/day37.md index 853732b..2dd3634 100644 --- a/zh_tw/Days/day37.md +++ b/zh_tw/Days/day37.md @@ -54,8 +54,11 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 幾乎所有的開發工具都支援 Git。 - 開發工具 - 我們曾經提到微軟的 visual studio code 有支援,其他的文字編輯器像是 sublime text 也有提供外掛整合 Git。 + - 團隊工具 - 用來做持續整合/持續佈署的 Jekins, Slack 的訊息框架和專案管理/問題追蹤系統 Jira。 + - 雲端供應商 - 所有的雲端供應商都有支援 Git,Microsoft Azure、Amazon AWS、Google Cloud Platform。 + - 基於Git的服務 - GitHub、GitLab 和 BitBucket 之後會有更詳盡的探討。我聽過這些服務是程式碼的社交網路! ### Git Cheatsheet @@ -66,7 +69,6 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git 基本操作 - | 指令 | 範例 | 描述 | | --------------- | ----------------------------- | ----------------------------------------------------------------------------------- | | git init | `git init ` | 在指定的資料夾上建立一個空的 Git 儲存庫。 | @@ -80,7 +82,6 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Undoing Changes - | 指令 | 範例 | 描述 | | ------------ | ----------------------- | ------------------------------------------------------------------------------------------- | | git revert | `git revert ` | 進行反向處理,回復該次提交的異動,並建立新的提交。 | @@ -89,7 +90,6 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Rewriting History - | 指令 | 範例 | 描述 | | ------------ | ---------------------- | --------------------------------------------------------------------------------------------------------------- | | git commit | `git commit --amend` | 將變更過的暫存區和最後的提交合併後取代最後一次的提交。 如果暫存區沒有變更就可以修改註解。 | @@ -98,7 +98,6 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Branches - | 指令 | 範例 | 描述 | | -------------- | ---------------------------- | --------------------------------------------------------------- | | git branch | `git branch` | 列出儲存庫上所有的分支。再加一個變數名字則可以建立新分支。 | @@ -107,7 +106,6 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Remote Repositories - | 指令 | 範例 | 描述 | | ---------------- | ------------------------------- | ------------------------------------------------------------------------------ | | git remote add | `git remote add ` | 為遠端的倉儲庫建立簡稱,方便之後進行推送。 | @@ -117,7 +115,6 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Diff - | 指令 | 範例 | 描述 | | ------------------- | --------------------- | ---------------------------------------- | | git diff HEAD | `git diff HEAD` | 比對最新的提交和工作目錄內的檔案內容。 | @@ -125,7 +122,6 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Config - | 指令 | 範例 | 描述 | | ----------------------------------------------------- | -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | | git config --global user.name | `git config --global user.name ` | 為系統現在登入的帳號定義每次使用 Git 提交時所用的作者名。 | @@ -136,21 +132,18 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Rebase - | 指令 | 範例 | 描述 | | --------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------ | | git rebase -i | `git rebase -i ` | 用非互動的方式將現在的分支嫁接到其他分支。另外啟動文字編輯器提供輸入每次提交時如何轉移到新的分支上。 | ### Git Pull - | 指令 | 範例 | 描述 | | --------------------------- | ------------------------------ | ------------------------------------------------ | | git pull --rebase | `git pull --rebase ` | 抓取放在遠端的分支並且嫁接在現在的工作目錄上。 | ### Git Reset - | 指令 | 範例 | 描述 | | -------------------------- | ----------------------------- | -------------------------------------------------------------------------- | | git reset | `git reset ` | 還原暫存區到最近提交的版本,但是不變動工作目錄的檔案。 | @@ -160,7 +153,6 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 ### Git Push - | 指令 | 範例 | Description | | -------------------------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------- | | git push --force | `git push --force` | 強迫推送即使會發生 non-fast-forward。不要用 --force 選項,除非你很清楚自己在做什麼。 | @@ -177,4 +169,5 @@ Git 對使用的人並不友善,事實上我們必須花費時間討論命令 - [Complete Git and GitHub Tutorial](https://www.youtube.com/watch?v=apGV9Kg7ics) - [Git cheatsheet](https://www.atlassian.com/git/tutorials/atlassian-git-cheatsheet) -See you on [第 38 天](day38.md) + +See you on [第 38 天](day38.md) \ No newline at end of file