“Today at the door of the canteen met a long secret love goddess, goddess smiled and gave me a piece of paper into the canteen, I opened the note to see the above write two words” calcium oxygen tungsten oxygen “, I thought it was blind to write on the throw, I sleep at night more think more wrong, now my intestines are regretting…”

Have you been confused by this language, anyway stupid uncle is confused! \

Let’s talk about a Git case. Well, when we accepted the project and selected the kernel version, the customer said, since the kernel of Uncle Ben uses 4.0, let’s develop it with 4.0. We were so happy to hear that. Create a Git tree that contains the git log information of all communities in Linux 4.0.

I asked Xiaoming to build this Git tree, but xiaoming didn’t get it out for a day. “Uncle, I only know how to create a Git tree and push all the files into a new git tree,” he said. “I have been searching the Internet for a day, but I have not found a reliable article.

So what? Let’s build the tree with Xiaoming.

01 done!

Let’s say we build this tree on top of the code cloud.

1) Log in to Gitee and create a new account.

2) Add SSH keys to gitee.

3) Create projects in Gitee

Enter “ben-linux-test” in the “Name” dialog, leave everything else as default, and click “New” to successfully create a New Git repository. The address of our new repository can be found on github:

Gitee.com/benshushu/b…

4) Download the repository locally.

$git clone gitee.com/benshushu/b…

5) At this time the warehouse is empty, we generate a patch and submit it to the remote warehouse.

$ cd ben-linux-test

$ echo “#ben-linux-test” >> README.md

$ git add README.md

$ git commit -m “firstcommit”

$ git push origin master

Finally, git push origin master is used to push the local repository to Github. You need to enter the github user name and password.

6) Download the official Linux repository code. The next step is to download the official Linux-4.0 code from this local Git repository. First we need to add the official Git repository for Linux. You can use the “git remote add” command to add a remote repository address, as shown below.

$git remote add Linux git.kernel.org/pub/scm/lin…

The git fetch command downloads the newly added remote repository code locally.

$ git fetch linux

7) Create a Linux 4.0 branch.

Next we need to add all the Commits for Linux 4.0 tabs in the official repository to the Master branch on Gitee. You first need to checkout a local branch called linux-4.0 from the remotes/ Linux/Master branch.

 

$git checkout -b Linux -4.0 Linux/Master

$git reset v4.0 –hard

The native Linux-4.0 branch is then a true Linux-4.0-based kernel and contains all the committed information on Linux 4.0.

8) Merge local changes to Linux 4.0

The next step is to merge all the local linux-4.0 commits into our local master branch.

$ git checkout master

$git Merge Linux-4.0 — Allow-Suggested – Histories

Finally, the local master branch commits like this:

Git logs for the Linux-4.0 kernel are now available on the master branch. The last step is just to push the master branch to our remote repository on Gitee.

$ git push origin master

After the push is completed, the final effect on the Gitee webpage is as shown in the figure.

Now Xiao Ming is convinced!