- bitbucketでprivate ripositoryを作成しておく
- 作業ディレクトリでcloneする
12345$git clone https://bbbae@bitbucket.org/bbbae/private_repository_name$cd private_repository_name$git remote -vorigin https://bbbae@bitbucket.org/bbbae/private_repository_name (fetch)origin https://bbbae@bitbucket.org/bbbae/private_repository_name (push)
- 作業状態を確認
-
1234567891011$ git statusブランチ masterYour branch is based on 'origin/master', but the upstream is gone.(use "git branch --unset-upstream" to fixup)追跡されていないファイル:(use "git add <file>..." to include in what will be committed)FileManager/nothing added to commit but untracked files present (use "git add" to track)$</file>
- ファイルを追加
-
123456789101112$ git add FileManager$ git statusブランチ masterYour branch is based on 'origin/master', but the upstream is gone.(use "git branch --unset-upstream" to fixup)コミット予定の変更点:(use "git reset HEAD <file>..." to unstage)new file: FileManager/a.outnew file: FileManager/main.cxx$</file>
- 追加ファイルを登録解除
-
12345678910111213141516$ git reset FileManager/a.out$ git statusブランチ masterYour branch is based on 'origin/master', but the upstream is gone.(use "git branch --unset-upstream" to fixup)コミット予定の変更点:(use "git reset HEAD <file>..." to unstage)new file: FileManager/main.cxx追跡されていないファイル:(use "git add </file><file>..." to include in what will be committed)FileManager/a.out$</file>
- 管理外のファイルを削除
-
123456$ git clean -nWould remove FileManager/a.out$ git clean -fRemoving FileManager/a.out$ git clean -n$
- コミット
-
12345678910$ git commit -m "adding FileManager"[master 1f2726d] adding FileManager1 file changed, 20 insertions(+)create mode 100644 FileManager/main.cxx$ git statusブランチ masterYour branch is based on 'origin/master', but the upstream is gone.(use "git branch --unset-upstream" to fixup)nothing to commit, working tree clean$
- プライベートリポジトリへpush
-
12345678910$ git pushPassword for 'https://bbbae@bitbucket.org':Counting objects: 8, done.Delta compression using up to 2 threads.Compressing objects: 100% (5/5), done.Writing objects: 100% (8/8), 887 bytes | 0 bytes/s, done.Total 8 (delta 0), reused 0 (delta 0)To https://bitbucket.org/bbbae/sample_clang* [new branch] master -> master$