Skip to content

Instantly share code, notes, and snippets.

@pebriana
Last active July 18, 2019 08:52
Show Gist options
  • Select an option

  • Save pebriana/3ee2f3c7d9d918b8c4dc to your computer and use it in GitHub Desktop.

Select an option

Save pebriana/3ee2f3c7d9d918b8c4dc to your computer and use it in GitHub Desktop.
how to git
Set up your local directory
mkdir /path/to/your/project
cd /path/to/your/project
git init
git remote add origin git@bitbucket.org:combro/misro-project.git
Create your first file, commit, and push
echo "Benyamin Sueb" >> contributors.txt
git add contributors.txt
git commit -m 'Initial commit with contributors'
git push -u origin master
Great job, now you're all set up! Get started coding or create a team and invite people to work with you.
or
git fetch && git checkout master
git remote -V
git remote add [namaremote] [url git]
git pus [namaremote]
=======================
git config --global user.email "email@gmail.com"
-git add .
-git commit
-push
=======================
cek status
git status
=======================
error ssh Permission denied (publickey).
fatal: Could not read from remote repository.
$ssh-keygen
$cat ~/.ssh/id_rsa.pub
=copypaste to bitbucket ssh_key generator.
========== branch rebase
git checkout branch
git rebase master
Sync a fork of a repository to keep it up-to-date with the upstream repository.
$ git remote -v
$ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
$ git remote -v
> origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
> origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
> upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)
> upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)
$ git fetch upstream
> remote: Counting objects: 75, done.
> remote: Compressing objects: 100% (53/53), done.
> remote: Total 62 (delta 27), reused 44 (delta 9)
> Unpacking objects: 100% (62/62), done.
> From https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY
> * [new branch] master -> upstream/master
$ git checkout master
$ git merge upstream/master
> Updating a422352..5fdff0f
> Fast-forward
https://medium.com/flawless-app-stories/useful-git-commands-for-everyday-use-e1a4de64037d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment