Git: Difference between revisions

From bibbleWiki
Jump to navigation Jump to search
Line 43: Line 43:
==Show Which Branch==
==Show Which Branch==
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
$ git branch
git branch
</syntaxhighlight>
==Merging==
This is how to merge from main to mybranch
<syntaxhighlight lang="bash">
// clone the source
git clone blahhhh
// checkout the branch
git checkout mybranch
// merge
git merge main
// Go into vs code
Take the version you care about
</syntaxhighlight>
</syntaxhighlight>

Revision as of 01:43, 8 April 2022

Helpful commands

Getting stuff from other branch

 git remote add live <other branch>
 git pull live master

Commit

 git commit -m "This is a great check in"
 git push

Checking out a branch

 git clone <address>
 git fetch origin
 git checkout <branch name>

Setting Credentials

 git config --global credential.helper store

Show non pushed changes

 git diff origin/master..HEAD

Put a cloned project into gitlab

git init
git remote set-url origin http://gitlab.com/bibble235/project.git
git commit -m "copy of project"
git push

Compare Branches

$ git diff branch1..branch2

Show Which Branch

git branch

Merging

This is how to merge from main to mybranch

// clone the source
git clone blahhhh
// checkout the branch
git checkout mybranch
// merge
git merge main
// Go into vs code
Take the version you care about