-
Notifications
You must be signed in to change notification settings - Fork 0
GitHub Basics
How to:
-
Determine if git is installed
git --version -
Determine git user
git config user.name -
Determine git user email
git config user.email -
Set user name
git config user.name "Your Name" -
Set user email
git config user.email "your@email.com" -
Create a repository (folder for an)
git init repository_name
git add -> copies files from working directory to staging area
git commit -> copies files from staging area to Repository
-
Check for commits
git status -
check changes since last commit
git diff -
Check changes since last add
get diff --staged -
Take a file out of staging and back to working
git reset file.txt -
View git history within a local repository
git log
== "Adding a remote allows you to transfer your commits to another machine"
-
Check to see if there is a remote location set-up for a local repository.
git remote -
Add a remote repository for a local repository.
git remote add origin http://xxgitxx.com/xxxxxx -
Push contents of local to remote
git push origin master -
Copy files from repository to local
git fetch -
View all branches.
tree .git/refs -
Establish connection to remote repo (Bookmark)
git remote add origin (REPO Location)Origin is the name of the remote connection - for latter use (defined by this command - user defined) -
To determine if there is a remote connection to repository
git remote -
Push branch to repo
git push origin master (mater is the default branch) -
Bookmarking the connection
git push -u origin masterAfter that git push will push master -
List bookmarks
git remotes -v (verbose) -
Retrieve files from GitHub fetch
-
Merge issues #fetching remote 'feature/my_feature_branch' branch to the 'tmp' local branch git fetch origin feature/my_feature_branch:tmp
#rebasing on local 'tmp' branch git rebase tmp
#pushing local changes to the remote git push origin HEAD:feature/my_feature_branch
#removing temporary created 'tmp' branch git branch -D tmp