GIT在Linux上的安装和使用简介

GIT在Linux上的安装和使用简介

1、下载和安装GIT

#下载
wget http://kernel.org/pub/software/scm/git/git-1.7.6.tar.bz2
#解压
tar xvfj git-1.7.6.tar.bz2
#编译安装
cd git-1.7.6
./configure
make
make install

2、初始化配置

#验证是否安装好
whereis git
git: /usr/local/bin/git
git  --version
git version 1.7.6
git  --help
#指定用户名和电子邮件
git config  --global user.name “GIT Admin”
git config  --global user.emal obugs.net@gmail.com
#验证配置信息
git config  --list
user.name=GIT Admin
user.email=obugs.net@gmail.com
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
#查看配置文件
cat ~/.gitconfig

[user]
name = GIT Admin
email = obugs.net@gmail.com

3、建立工程

#定义git工程
cd /home/obugs/projects/orangebugs
git init
Initialized empty Git repository in /home/obugs/projects/orangebugs/.git/
#授权
ls -altr .git
total 40
drwxrwxr-x 4 git git 4096 Aug 13 22:39 refs
drwxrwxr-x 4 git git 4096 Aug 13 22:39 objects
drwxrwxr-x 2 git git 4096 Aug 13 22:39 info
drwxrwxr-x 2 git git 4096 Aug 13 22:39 hooks
-rw-rw-r -- 1 git git 23 Aug 13 22:39 HEAD
-rw-rw-r -- 1 git git 73 Aug 13 22:39 description
-rw-rw-r -- 1 git git 92 Aug 13 22:39 config
drwxrwxr-x 2 git git 4096 Aug 13 22:39 branches
drwxrwxr-x 36 git git 4096 Aug 13 22:39 ..
drwxrwxr-x 7 git git 4096 Aug 13 22:39 .

4、向工程添加和提交文件

#添加文件
git add *.java *.c
git commit -m ‘Initial upload of the project’
create mode 100755 Orangebugs.java
create mode 100755 pwm/ui/DataManager.java
create mode 100755 pwm/ui/PasswordFrame.java
create mode 100755 pwm/tools/StrongEncryption.java
create mode 100755 pwm/tools/PasswordStrength.java
#注意如果之前没有使用 git config 指定用户名和电子邮件地址,这里会报错
git commit -m ‘Initial upload of the project'

*** Please tell me who you are.  
Run
git config  --global user.email “you@example.com”
git config  --global user.name “Your Name”
to set your account’s default identity.
Omit  --global to set the identity only in this repository.
fatal: empty ident not allowed

5、更改文件和提交改动

#更改文件
vi Orangebugs.java
#比较差异
git diff
diff  --git a/Orangebugs.java b/Orangebugs.java
index 6166ed1
..fd82d32 100644 — a/Orangebugs.java +++ b/Orangebugs.java @@ -2,7 +2,7 @@ - public counter=10 + public counter=55 #提交文件 git add Orangebugs.java git commit
[master 80f10a9] Added password strength meter functionality
1 files changed, 56 insertions(+), 7 deletions(-)

6、查看状态和查看注释

#查看状态(无改动)
git status

# On branch master
nothing to commit (working directory clean)
#查看状态(有改动但未提交)
git status
# On branch master # Changes not staged for commit: # (use “git add …” to update what will be committed) # (use “git checkout — …” to discard changes in working directory) # # modified: Orangebugs.java # no changes added to commit (use "git add" and/or "git commit -a") #查看历史记录和注释 git log Orangebugs.java commit c919ced7f42f4bc06d563c1a1eaa107f2b2420d5 Author: GIT Admin www.2cto.com Date: Sat Aug 13 22:54:57 2011 -0700 Added password strength meter functionality commit c141b7bdbff429de35e36bafb2e43edc655e9957 Author: GIT Admin Date: Sat Aug 13 20:08:02 2011 -0700 Initial upload of the project

 

转载于:https://www.cnblogs.com/boystar/p/4741414.html

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/109353.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • dropout层

    dropout层之前了解的网络都是在全连接层加dropout层,防止模型过拟合。在看deepfm的模型的时候,发现在每一层都可以加入dropout层对dropout层的深入理解做分类的时候,Dropout层一般加在全连接层防止过拟合提升模型泛化能力。而很少见到卷积层后接Dropout(原因主要是卷积参数少,不易过拟合)er类似卷积神经网络,只是在最后的全连接层使用dropout,循环神经…

    2022年6月10日
    61
  • 面试手写代码的经验分享

    面试手写代码的经验分享前言今天分享一下自己面试的时候遇到的写面试题的经验分享。在面试的时候,分为视频面试和现场面试,接下来讲解着两部分。视频面试在我和我周围的同学参加过的公司里面,不在现场的面…

    2022年5月16日
    35
  • 善待自己:改变命运的N个人生哲理

    善待自己:改变命运的N个人生哲理心灵的栅栏  人与月亮的距离并不遥远,因为人与人心灵间的距离更为遥远。  ——王尔德    当玛格丽特的丈夫杰瑞因脑瘤去世后,她变得异常愤怒,生活太不公平,她憎恨孤独。孀居3年,她的脸变得紧绷绷的。  一天,玛格丽特在小镇拥挤的路上开车,忽然发现一幢她喜欢的房子周围竖起一道新的栅栏。那房子已有一百多年的历史,颜色变白,有很大的门廊,过去一直隐藏在路后面。如今马路扩展,街口竖起了红绿灯,小镇已颇有些

    2022年7月12日
    10
  • 7种方法求解八数码问题

    【八数码问题】//https://vijos.org/p/1360在3×3的棋盘上,摆有八个棋子,每个棋子上标有1至8的某一数字。棋盘中留有一个空格,空格用0来表示。空格周围的棋子可以移到空格中。要求解的问题是:给出一种初始布局(初始状态)和目标布局(为了使题目简单,设目标状态为123804765),找到一种最少步骤的移动方法,实现从初始布局到目标布局的转变。【分析】题目读完第一感

    2022年4月5日
    163
  • IsBackground_background和background-color

    IsBackground_background和background-color1、当在主线程中创建了一个线程,那么该线程的IsBackground默认是设置为FALSE的。2、当主线程退出的时候,IsBackground=FALSE的线程还会继续执行下去,直到线程执行结束。3、只有IsBackground=TRUE的线程才会随着主线程的退出而退出。4、当初始化一个线程,把Thread.IsBackground=true的时候,指示该线程为后台线程。后台…

    2022年10月17日
    0
  • 费曼学习法

    费曼学习法费曼学习法我的理解:费曼学习法就是把学好的东西用简洁易懂的语言,传授给别人举例:你学完微积分,然后自己去培训班,自己做老师,传授给学生们,并且学生们都能听懂费曼学习法的四个步骤:1.确定目标

    2022年7月29日
    5

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号