Browse Source

add git cmd history

remotes/origin/HEAD fetched-on-2023-11-27
fdai7755 1 year ago
parent
commit
1d4541ee12
  1. 426
      git.txt

426
git.txt

@ -0,0 +1,426 @@
fdai7755@pc13:~$ cd
fdai7755@pc13:~$ ls
Desktop Downloads Music Public Videos
Documents Lerntagebuch Pictures Templates
fdai7755@pc13:~$ mkdir uebung_git
fdai7755@pc13:~$ cd uebung_git/
fdai7755@pc13:~/uebung_git$ git init local_repository
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /home/fdai7755/uebung_git/local_repository/.git/
fdai7755@pc13:~/uebung_git$ ls
local_repository
fdai7755@pc13:~/uebung_git$ git init.defaultBranch master
git: 'init.defaultBranch' is not a git command. See 'git --help'.
fdai7755@pc13:~/uebung_git$ git config --global init.defaultBranch master
fdai7755@pc13:~/uebung_git$ cd local_repository/
fdai7755@pc13:~/uebung_git/local_repository$ ls
fdai7755@pc13:~/uebung_git/local_repository$ ls -l
total 0
fdai7755@pc13:~/uebung_git/local_repository$ ls -a
. .. .git
fdai7755@pc13:~/uebung_git/local_repository$ echo eins >> beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ echo zwei >> beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ echo drei >> beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ echo vier >> beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ ls
beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ echo beispiel.txt
beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ echo || less beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ echo | less beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ cat beispiel.txt
eins
zwei
drei
vier
fdai7755@pc13:~/uebung_git/local_repository$ git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
beispiel.txt
nothing added to commit but untracked files present (use "git add" to track)
fdai7755@pc13:~/uebung_git/local_repository$ git add beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ git commit -m "initialer commit"
[master (root-commit) 376ebd1] initialer commit
1 file changed, 4 insertions(+)
create mode 100644 beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ echo fünf >> beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ echo sechs >> beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ echo sieben >> beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ echo acht >> beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ echo neun >> beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ cat beispiel.txt
eins
zwei
drei
vier
fünf
sechs
sieben
acht
neun
fdai7755@pc13:~/uebung_git/local_repository$ nano beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ cat beispiel.txt
eins
zwei
drei
vier
fünf
sechs
sieben
acht
neun
Hallo
ich bins
fdai7755@pc13:~/uebung_git/local_repository$ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: beispiel.txt
no changes added to commit (use "git add" and/or "git commit -a")
fdai7755@pc13:~/uebung_git/local_repository$ git add beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ git status
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ git commit -m "neue Wörter hinzugefügt"
[master 85c669d] neue Wörter hinzugefügt
1 file changed, 7 insertions(+)
fdai7755@pc13:~/uebung_git/local_repository$ git --help
usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
[--super-prefix=<path>] [--config-env=<name>=<envvar>]
<command> [<args>]
These are common Git commands used in various situations:
start a working area (see also: git help tutorial)
clone Clone a repository into a new directory
init Create an empty Git repository or reinitialize an existing one
work on the current change (see also: git help everyday)
add Add file contents to the index
mv Move or rename a file, a directory, or a symlink
restore Restore working tree files
rm Remove files from the working tree and from the index
examine the history and state (see also: git help revisions)
bisect Use binary search to find the commit that introduced a bug
diff Show changes between commits, commit and working tree, etc
grep Print lines matching a pattern
log Show commit logs
show Show various types of objects
status Show the working tree status
grow, mark and tweak your common history
branch List, create, or delete branches
commit Record changes to the repository
merge Join two or more development histories together
rebase Reapply commits on top of another base tip
reset Reset current HEAD to the specified state
switch Switch branches
tag Create, list, delete or verify a tag object signed with GPG
collaborate (see also: git help workflows)
fetch Download objects and refs from another repository
pull Fetch from and integrate with another repository or a local branch
push Update remote refs along with associated objects
'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
See 'git help git' for an overview of the system.
fdai7755@pc13:~/uebung_git/local_repository$ git log
commit 85c669d265b90b546ca6535f0fa367329ebc6be8 (HEAD -> master)
Author: fdai7755 <georg.volkmar1@informatik.hs-fulda.de>
Date: Thu Nov 16 14:07:40 2023 +0100
neue Wörter hinzugefügt
commit 376ebd1b28468396bcf636856a4175678514aadd
Author: fdai7755 <georg.volkmar1@informatik.hs-fulda.de>
Date: Thu Nov 16 14:03:09 2023 +0100
initialer commit
fdai7755@pc13:~/uebung_git/local_repository$ git log --oneline
85c669d (HEAD -> master) neue Wörter hinzugefügt
376ebd1 initialer commit
fdai7755@pc13:~/uebung_git/local_repository$ git log --oneline --graph
* 85c669d (HEAD -> master) neue Wörter hinzugefügt
* 376ebd1 initialer commit
fdai7755@pc13:~/uebung_git/local_repository$ nano beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ git div
git: 'div' is not a git command. See 'git --help'.
The most similar command is
diff
fdai7755@pc13:~/uebung_git/local_repository$ git div beispiel.txt
git: 'div' is not a git command. See 'git --help'.
The most similar command is
diff
fdai7755@pc13:~/uebung_git/local_repository$ git diff beispiel.txt
diff --git a/beispiel.txt b/beispiel.txt
index 0ec0bfe..21323c2 100644
--- a/beispiel.txt
+++ b/beispiel.txt
@@ -1,8 +1,8 @@
eins
zwei
-drei
+3
vier
-fünf
+5
sechs
sieben
acht
fdai7755@pc13:~/uebung_git/local_repository$ git add -i
staged unstaged path
1: unchanged +2/-2 beispiel.txt
*** Commands ***
1: status 2: update 3: revert 4: add untracked
5: patch 6: diff 7: quit 8: help
What now> u
staged unstaged path
1: unchanged +2/-2 beispiel.txt
Update>> 1
staged unstaged path
* 1: unchanged +2/-2 beispiel.txt
Update>>
updated 1 path
*** Commands ***
1: status 2: update 3: revert 4: add untracked
5: patch 6: diff 7: quit 8: help
What now> q
Bye.
fdai7755@pc13:~/uebung_git/local_repository$ git status
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ git gui
fdai7755@pc13:~/uebung_git/local_repository$ git status
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ git commit -m "partielle Änderung"
[master 7e0df0a] partielle Änderung
1 file changed, 2 insertions(+), 2 deletions(-)
fdai7755@pc13:~/uebung_git/local_repository$ git stauts
git: 'stauts' is not a git command. See 'git --help'.
The most similar command is
status
fdai7755@pc13:~/uebung_git/local_repository$ git stats
git: 'stats' is not a git command. See 'git --help'.
The most similar command is
status
fdai7755@pc13:~/uebung_git/local_repository$ git status
On branch master
nothing to commit, working tree clean
fdai7755@pc13:~/uebung_git/local_repository$ git diff
fdai7755@pc13:~/uebung_git/local_repository$ git diff
diff --git a/beispiel.txt b/beispiel.txt
index 21323c2..9791872 100644
--- a/beispiel.txt
+++ b/beispiel.txt
@@ -9,3 +9,5 @@ acht
neun
Hallo
ich bins
+hey
+hey
fdai7755@pc13:~/uebung_git/local_repository$ git reset beispiel.txt
Unstaged changes after reset:
M beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ git diff
diff --git a/beispiel.txt b/beispiel.txt
index 21323c2..9791872 100644
--- a/beispiel.txt
+++ b/beispiel.txt
@@ -9,3 +9,5 @@ acht
neun
Hallo
ich bins
+hey
+hey
fdai7755@pc13:~/uebung_git/local_repository$ git restore beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ git diff
fdai7755@pc13:~/uebung_git/local_repository$ git checkout
fdai7755@pc13:~/uebung_git/local_repository$ git diff
fdai7755@pc13:~/uebung_git/local_repository$ git checkout -b test1
Switched to a new branch 'test1'
fdai7755@pc13:~/uebung_git/local_repository$ git status
On branch test1
nothing to commit, working tree clean
fdai7755@pc13:~/uebung_git/local_repository$ git log --oneline --graph --all
* 7e0df0a (HEAD -> test1, master) partielle Änderung
* 85c669d neue Wörter hinzugefügt
* 376ebd1 initialer commit
fdai7755@pc13:~/uebung_git/local_repository$ git add beispiel.txt && git commit -m "änderungen in Zweig 1"
[test1 f1e76f3] änderungen in Zweig 1
1 file changed, 6 insertions(+)
fdai7755@pc13:~/uebung_git/local_repository$ git log --oneline --graph --all
* f1e76f3 (HEAD -> test1) änderungen in Zweig 1
* 7e0df0a (master) partielle Änderung
* 85c669d neue Wörter hinzugefügt
* 376ebd1 initialer commit
fdai7755@pc13:~/uebung_git/local_repository$ git ui
git: 'ui' is not a git command. See 'git --help'.
The most similar command is
gui
fdai7755@pc13:~/uebung_git/local_repository$ git gui
^C
fdai7755@pc13:~/uebung_git/local_repository$ git switch master
Switched to branch 'master'
fdai7755@pc13:~/uebung_git/local_repository$ git checkout -b test2
Switched to a new branch 'test2'
fdai7755@pc13:~/uebung_git/local_repository$ git switch test2
Already on 'test2'
fdai7755@pc13:~/uebung_git/local_repository$ git add beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ git commit -m "änderung in Zweig2"
[test2 44e26a2] änderung in Zweig2
1 file changed, 4 insertions(+)
fdai7755@pc13:~/uebung_git/local_repository$ git log --oneline --graph --all
* 44e26a2 (HEAD -> test2) änderung in Zweig2
| * f1e76f3 (test1) änderungen in Zweig 1
|/
* 7e0df0a (master) partielle Änderung
* 85c669d neue Wörter hinzugefügt
* 376ebd1 initialer commit
fdai7755@pc13:~/uebung_git/local_repository$ git gui
^C
fdai7755@pc13:~/uebung_git/local_repository$ git log --oneline --graph
* 44e26a2 (HEAD -> test2) änderung in Zweig2
* 7e0df0a (master) partielle Änderung
* 85c669d neue Wörter hinzugefügt
* 376ebd1 initialer commit
fdai7755@pc13:~/uebung_git/local_repository$ git merge test1
Auto-merging beispiel.txt
CONFLICT (content): Merge conflict in beispiel.txt
Automatic merge failed; fix conflicts and then commit the result.
fdai7755@pc13:~/uebung_git/local_repository$ git add beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ git status
On branch test2
All conflicts fixed but you are still merging.
(use "git commit" to conclude merge)
Changes to be committed:
modified: beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ git commit
[test2 b41571e] Merge branch 'test1' into test2
fdai7755@pc13:~/uebung_git/local_repository$ git log
commit b41571ef7e6313f74f445cad165d778906dc0155 (HEAD -> test2)
Merge: 44e26a2 f1e76f3
Author: fdai7755 <georg.volkmar1@informatik.hs-fulda.de>
Date: Thu Nov 16 14:47:07 2023 +0100
Merge branch 'test1' into test2
commit 44e26a26233a843c432a3c1d20c619aeba845ca6
Author: fdai7755 <georg.volkmar1@informatik.hs-fulda.de>
Date: Thu Nov 16 14:40:39 2023 +0100
änderung in Zweig2
commit f1e76f3835c59dcf7b6d304f5182512a49e360bc (test1)
Author: fdai7755 <georg.volkmar1@informatik.hs-fulda.de>
Date: Thu Nov 16 14:32:49 2023 +0100
änderungen in Zweig 1
commit 7e0df0a07b9c2b1e71a0b76bf2555273334676b3 (master)
Author: fdai7755 <georg.volkmar1@informatik.hs-fulda.de>
Date: Thu Nov 16 14:22:48 2023 +0100
fdai7755@pc13:~/uebung_git/local_repository$ git log --oneline --graph
* b41571e (HEAD -> test2) Merge branch 'test1' into test2
|\
| * f1e76f3 (test1) änderungen in Zweig 1
* | 44e26a2 änderung in Zweig2
|/
* 7e0df0a (master) partielle Änderung
* 85c669d neue Wörter hinzugefügt
* 376ebd1 initialer commit
fdai7755@pc13:~/uebung_git/local_repository$ ^C
fdai7755@pc13:~/uebung_git/local_repository$ git reset 44e26a2
Unstaged changes after reset:
M beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ git status
On branch test2
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: beispiel.txt
no changes added to commit (use "git add" and/or "git commit -a")
fdai7755@pc13:~/uebung_git/local_repository$ git reset --hard
HEAD is now at 44e26a2 änderung in Zweig2
fdai7755@pc13:~/uebung_git/local_repository$ git log --oneline --graph --all
* 44e26a2 (HEAD -> test2) änderung in Zweig2
| * f1e76f3 (test1) änderungen in Zweig 1
|/
* 7e0df0a (master) partielle Änderung
* 85c669d neue Wörter hinzugefügt
* 376ebd1 initialer commit
fdai7755@pc13:~/uebung_git/local_repository$ git switch test1
Switched to branch 'test1'
fdai7755@pc13:~/uebung_git/local_repository$ git merge test2
Auto-merging beispiel.txt
CONFLICT (content): Merge conflict in beispiel.txt
Automatic merge failed; fix conflicts and then commit the result.
fdai7755@pc13:~/uebung_git/local_repository$ git merge --abort
fdai7755@pc13:~/uebung_git/local_repository$ git status
On branch test1
nothing to commit, working tree clean
fdai7755@pc13:~/uebung_git/local_repository$ git merge test2
Auto-merging beispiel.txt
CONFLICT (content): Merge conflict in beispiel.txt
Automatic merge failed; fix conflicts and then commit the result.
fdai7755@pc13:~/uebung_git/local_repository$ git add beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ git status
On branch test1
All conflicts fixed but you are still merging.
(use "git commit" to conclude merge)
Changes to be committed:
modified: beispiel.txt
fdai7755@pc13:~/uebung_git/local_repository$ git commit
[test1 32c26f9] Merge branch 'test2' into test1
fdai7755@pc13:~/uebung_git/local_repository$ git status
On branch test1
nothing to commit, working tree clean
fdai7755@pc13:~/uebung_git/local_repository$ git switch master
Switched to branch 'master'
fdai7755@pc13:~/uebung_git/local_repository$
Loading…
Cancel
Save