728x90

 

ball 변수에 배열 선언 및 길이까지 할당

a = b

b = c

c = a

로직을 이용하여 Math.random()으로 생성한 난수를 j에 넣고 

temp에 ball[i]를 넣어서 임시 보관시키고, 

난수 생성한 j를 ball인덱스 번호에 넣은 ball[j]를 ball[i] 다시 넣고

ball[j]에는 tmp에 넣어두었던 ball[i]를 다시 넣으므로써 스위칭이 가능해진다

 

 

 // 로또번호 6개 만들기
        // 45개의 정수값을 저장하기 위한 배열 생성.
        int[] ball = new int[45];

        // 배열의 각 요소에 1~45의 값을 저장한다.
        for(int i=0; i < ball.length; i++)
            ball[i] = i+1;
        System.out.println(Arrays.toString(ball));

        int temp = 0; // 두 값을 바꾸는데 사용할 임시변수
        int j = 0;    // 임의의 값을 얻어서 저장할 변수

        // 배열의 i번째 요소와 임의의 요소에 저장된 값을 서로 바꿔서 값을 섞는다.
        // 0번째 부터 5번째 요소까지 모두 6개만 바꾼다.
        for(int i=0; i < 6; i++){
            j = (int)(Math.random()*45); // 0~44범위의 임의의 값을 얻는다.
            temp = ball[i];
            ball[i] = ball[j];
            ball[j] = temp;
            System.out.println(Arrays.toString(ball));
        }

        // 배열 ball의 앞에서 부터 6개의 요소를 출력한다.
        for(int i=0; i < 6; i++)
            System.out.printf("ball[%d]=%d%n", i, ball[i]);
728x90
반응형
728x90

 

1. 브랜치(branch) 생성 : branch

$ git branch 브랜치명

예시

$ git branch test1

2.브랜치(branch) 변경 : checkout

$ git checkout 브랜치명

 

 ※ 브랜치(branch) 생성 및 변경 한번에

-b 추가

$ git checkout **-b** 브랜치명

3.Merge

$ git **merge** <commit>

 

4. 브랜치(branch) 삭제 : branch -d

$ git **branch -d** 브랜치명

 

 

 

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository
$ git init
Initialized empty Git repository in D:/Git_Repository/.git/

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (master)
$ git branch -b test1
error: unknown switch `b'
usage: git branch [<options>] [-r | -a] [--merged] [--no-merged]
   or: git branch [<options>] [-f] [--recurse-submodules] <branch-name> [<start-point>]
   or: git branch [<options>] [-l] [<pattern>...]
   or: git branch [<options>] [-r] (-d | -D) <branch-name>...
   or: git branch [<options>] (-m | -M) [<old-branch>] <new-branch>
   or: git branch [<options>] (-c | -C) [<old-branch>] <new-branch>
   or: git branch [<options>] [-r | -a] [--points-at]
   or: git branch [<options>] [-r | -a] [--format]

Generic options
    -v, --verbose         show hash and subject, give twice for upstream branch
    -q, --quiet           suppress informational messages
    -t, --track[=(direct|inherit)]
                          set branch tracking configuration
    -u, --set-upstream-to <upstream>
                          change the upstream info
    --unset-upstream      unset the upstream info
    --color[=<when>]      use colored output
    -r, --remotes         act on remote-tracking branches
    --contains <commit>   print only branches that contain the commit
    --no-contains <commit>
                          print only branches that don't contain the commit
    --abbrev[=<n>]        use <n> digits to display object names

Specific git-branch actions:
    -a, --all             list both remote-tracking and local branches
    -d, --delete          delete fully merged branch
    -D                    delete branch (even if not merged)
    -m, --move            move/rename a branch and its reflog
    -M                    move/rename a branch, even if target exists
    -c, --copy            copy a branch and its reflog
    -C                    copy a branch, even if target exists
    -l, --list            list branch names
    --show-current        show current branch name
    --create-reflog       create the branch's reflog
    --edit-description    edit the description for the branch
    -f, --force           force creation, move/rename, deletion
    --merged <commit>     print only branches that are merged
    --no-merged <commit>  print only branches that are not merged
    --column[=<style>]    list branches in columns
    --sort <key>          field name to sort on
    --points-at <object>  print only branches of the object
    -i, --ignore-case     sorting and filtering are case insensitive
    --recurse-submodules  recurse through submodules
    --format <format>     format to use for the output


csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (master)
$ git branch

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (master)
$ git branch test1
fatal: not a valid object name: 'master'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (master)
$ 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.

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (master)
$ git branch

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (master)
$ git branch test
fatal: not a valid object name: 'master'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (master)
$ git branch test1
fatal: not a valid object name: 'master'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (master)
$ git branch master
fatal: not a valid object name: 'master'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (master)
$ git checkout test1
error: pathspec 'test1' did not match any file(s) known to git

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (master)
$ git checkout test
error: pathspec 'test' did not match any file(s) known to git

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (master)
$ git branch a
fatal: not a valid object name: 'master'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (master)
$ ls -al
total 20
drwxr-xr-x 1 csy62 197609 0 Jul 31 03:18 ./
drwxr-xr-x 1 csy62 197609 0 Jul 14 08:20 ../
drwxr-xr-x 1 csy62 197609 0 Jul 31 03:17 .git/
-rw-r--r-- 1 csy62 197609 0 Jul 31 03:18 a.txt

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (master)
$ git branch test
fatal: not a valid object name: 'master'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (master)
$ git branch 'test'
fatal: not a valid object name: 'master'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (master)
$ git commit -m 1
On branch master

Initial commit

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        a.txt

nothing added to commit but untracked files present (use "git add" to track)

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (master)
$ git add a.txt

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (master)
$ git commit -m 1
[master (root-commit) 0505a6a] 1
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 a.txt

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (master)
$ git branch test

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (master)
$ git branch -m test1

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git branch
  test
* test1

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git checkout test
Switched to branch 'test'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test)
$ git checkout -b test2
Switched to a new branch 'test2'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git branch
  test
  test1
* test2

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git checkout test
Switched to branch 'test'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test)
$ git branch -m test0

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test0)
$ git branch
* test0
  test1
  test2

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test0)
$ git branch -d test2
Deleted branch test2 (was 0505a6a).

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test0)
$ git checkout -b test2
Switched to a new branch 'test2'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git checkout test1
Switched to branch 'test1'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git merge test2
Already up to date.

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git checkout test2
Switched to branch 'test2'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git add .

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git commit -m 1
On branch test2
nothing to commit, working tree clean

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git branch
  test0
  test1
* test2

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git branch -d test2
error: Cannot delete branch 'test2' checked out at 'D:/Git_Repository'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git checkout -b test3
Switched to a new branch 'test3'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test3)
$ git checkout test2
Switched to branch 'test2'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git branch -d test3
Deleted branch test3 (was 0505a6a).

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git add .

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git checkout test2
Already on 'test2'
A       "a - \353\263\265\354\202\254\353\263\270.txt"

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git checkout test1
Switched to branch 'test1'
A       "a - \353\263\265\354\202\254\353\263\270.txt"

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git merge test2
Already up to date.

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git checkout test2
Switched to branch 'test2'
A       "a - \353\263\265\354\202\254\353\263\270.txt"

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git add .

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git commit -m 1
[test2 76d033f] 1
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 "a - \353\263\265\354\202\254\353\263\270.txt"

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git checkout test1
Switched to branch 'test1'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git merge test1
Already up to date.

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git checkout test2
Switched to branch 'test2'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git merge test3
merge: test3 - not something we can merge

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git merge test1
Already up to date.

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git branch
  test0
  test1
* test2

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git merge master
merge: master - not something we can merge

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git add .

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git show
commit 76d033f78943e8d9856b60b2c323dd80098a23fe (HEAD -> test2)
Author: neverGiveUpppppp <csy6219@naver.com>
Date:   Sun Jul 31 03:30:07 2022 +0900

    1

diff --git "a/a - \353\263\265\354\202\254\353\263\270.txt" "b/a - \353\263\265\354\202\254\353\263\270.txt"
new file mode 100644
index 0000000..e69de29

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git status
On branch test2
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        new file:   "a - \353\263\265\354\202\254\353\263\270 - \353\263\265\354\202\254\353\263\270.txt"


csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git commit -m 1
[test2 c0f83ba] 1
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 "a - \353\263\265\354\202\254\353\263\270 - \353\263\265\354\202\254\353\263\270.txt"

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git merge
fatal: No remote for the current branch.

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git test1
git: 'test1' is not a git command. See 'git --help'.

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git checkout test1
Switched to branch 'test1'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git merge test2
Updating 0505a6a..c0f83ba
Fast-forward
 ...65\354\202\254\353\263\270 - \353\263\265\354\202\254\353\263\270.txt" | 0
 "a - \353\263\265\354\202\254\353\263\270.txt"                            | 0
 2 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 "a - \353\263\265\354\202\254\353\263\270 - \353\263\265\354\202\254\353\263\270.txt"
 create mode 100644 "a - \353\263\265\354\202\254\353\263\270.txt"

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git status
On branch test1
nothing to commit, working tree clean

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git show
commit c0f83baab10cff7a90120db6ba4f3975c3e743f7 (HEAD -> test1, test2)
Author: neverGiveUpppppp <csy6219@naver.com>
Date:   Sun Jul 31 03:32:43 2022 +0900

    1

diff --git "a/a - \353\263\265\354\202\254\353\263\270 - \353\263\265\354\202\254\353\263\270.txt" "b/a - \353\263\265\354\202\254\353\263\270 - \353\263\265\354\202\254\353\263\270.txt"
new file mode 100644
index 0000000..e69de29

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git branch
  test0
* test1
  test2

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git checkout test2
Switched to branch 'test2'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git add .

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git commit -m 2
[test2 d4529f8] 2
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 "a - \353\263\265\354\202\254\353\263\270 - \353\263\265\354\202\254\353\263\270 - \353\263\265\354\202\254\353\263\270.txt"

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git checkout test1
Switched to branch 'test1'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git add .

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git commit -m 3
On branch test1
nothing to commit, working tree clean

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git branch
  test0
* test1
  test2

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git checkout test3
error: pathspec 'test3' did not match any file(s) known to git

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git checkout test2
Switched to branch 'test2'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test2)
$ git checkout test1
Switched to branch 'test1'

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git branch -d test2
error: The branch 'test2' is not fully merged.
If you are sure you want to delete it, run 'git branch -D test2'.

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git merge test2
Updating c0f83ba..d4529f8
Fast-forward
 ...65\354\202\254\353\263\270 - \353\263\265\354\202\254\353\263\270.txt" | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 "a - \353\263\265\354\202\254\353\263\270 - \353\263\265\354\202\254\353\263\270 - \353\263\265\354\202\254\353\263\270.txt"

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git branch -d test2
Deleted branch test2 (was d4529f8).

csy62@DESKTOP-QNAHH4K MINGW64 /d/Git_Repository (test1)
$ git branch
  test0
* test1
728x90
반응형
728x90

 

깃허브 브랜치(branch) 생성 & 변경 

깃허브 브랜치(branch) 생성하고 생성한 브랜치로 변경해보기

 

git help 누르면 각종 명령어와 도움말들을 얻을 수 있다

 

1.브랜치 생성

git branch 브랜치명

create라는 이름을 가진 브랜치를 master 브랜치에 세팅했다고 한다

 

 

2.브랜치 변경

create라는 이름을 가진 branch에서 master 브랜치로 옮겨갔다

빨간줄을 보면 커맨드 입력 후 create -> master로 바뀐 것을 볼 수 있다

명령어는 git switch 브랜치명

 

 

 

 

728x90
반응형
728x90

[GitBash] 브랜치 생성, 변경, 통합 등 이모저모

 

체크아웃으로 브랜치 옮겨다니고 

merge 기존에 만들어둔 브랜치를 합치려니까 컨플릭트 뜸

깃허브에서 pull request 했을 때 컨플릭트 뜬 건 resolve해봤는데

깃배쉬에서는 충돌나는 부분이 안떠서 어찌해야할지 구글링 했는데

깃배쉬 관련은 안나오고 전부 git이나 다른 프로그램 사용하는 거만 뜨는 중...

 

 

 

 

 

728x90
반응형
728x90

 

 

1. 브랜치(branch) 생성

$ git branch 브랜치명

예시

$ git checkout test1

 

2.브랜치(branch) 변경

$ git checkout 브랜치명

예시

$ git checkout test1

 

※ 브랜치(branch) 생성 및 변경 한번에

$ git checkout -b 브랜치명

 

 

3.’test1' 브랜치의 변경 사항을 'master' 브랜치에 병합하기 : Merge

브랜치 병합 명령어 : merge

이 명령어에 병합할 커밋 이름을 넣어 실행하면, 지정한 커밋 내용이 'HEAD'가 가리키고 있는 브랜치에 넣어집니다. 'HEAD'는 현재 사용중인 브랜치에 위치하게 됩니다. 위 그림에서는 'issue1' 커밋에 'HEAD'가 위치하고 있습니다.

$ git merge 커밋명

master브랜치에 원하는 브랜치를 머지하기 위해  master브랜치가 HEAD가 되도록 해야한다.

이때, checkout 명령어를 이용하여 현재 사용중인 브랜치를 master로 전환해야함

 

4. 브랜치(branch) 삭제 : branch -d

$ git branch -d 브랜치명

 

 

 

728x90
반응형
728x90

 

1.CMD 진입

2. sql진입 : sqlplus 명령어 입력 & 엔터

3. 계정로그인

4. 시스템계정 진입 : conn/as sysdba;

계정 생성 : create user 유저명 identified by 비번; 

계정 권한부여 : grant resource,connect to 아이디;

저장 : commit;

 

 

 

728x90
반응형

+ Recent posts