Post

20 Working with branches

20 Working with branches

Command:

1
2
$ cd checks
$ git status

Code output:

1
2
3
On branch even-better-feature

nothing to commit, working tree clean

Command:

1
$ ls -l

Code output:

1
2
3
4
5
total 8

-rw-rw-r-- 1 user user 659 Jul 17 00:02 disk_usage.py

-rw-rw-r-- 1 user user  53 Jul 17 15:33 free_memory.py

Command:

1
$ git checkout master

Code output:

1
Switched to branch 'master'

Command:

1
$ git log -2

Code output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
commit 80b2dacef4b567196e61651064f03089c5e70b5e (HEAD -> master, new-feature)

Author: artwalker <artwalker@example.com>

Date:   Wed Jul 17 00:02:39 2019 +0200

    Revert "New name for disk_usage.py"

    

    Rollback reason: the previous name was actually better.

    

    This reverts commit 7d7167b2db44abf8cf014230f9b9708786e41c2a.

commit abb063210c1f011b0d6470a4c5f1d8f672edd3ef

Author: artwalker <artwalker@example.com>

Date:   Mon Jul 15 22:20:45 2019 +0200

    Add a gitignore file, ignoring .DS_STORE files

Command:

1
$ ls -l

Code output:

1
2
3
total 4

-rw-rw-r-- 1 user user 659 Jul 17 00:02 disk_usage.py

Command:

1
$ git branch

Code output:

1
2
3
4
5
 even-better-feature

* master

  new-feature

Command:

1
$ git branch -d new-feature 

Code output:

1
Deleted branch new-feature (was 80b2dac).

Command:

1
$ git branch

Code output:

1
2
3
  even-better-feature

* master

Command:

1
$ git branch -d even-better-feature 

Code output:

1
2
3
error: The branch 'even-better-feature' is not fully merged.

If you are sure you want to delete it, run 'git branch -D even-better-feature'.
This post is licensed under CC BY 4.0 by the author.