All Projects → taniarascia → Git

taniarascia / Git

Licence: mit
Useful Git commands.

Projects that are alternatives of or similar to Git

Git Novice
Version Control with Git
Stars: ✭ 227 (+108.26%)
Mutual labels:  versioning, version-control
python-aos-lesson
Python for Atmosphere and Ocean Scientists
Stars: ✭ 78 (-28.44%)
Mutual labels:  version-control, versioning
clearml-server-helm
ClearML Server for Kubernetes Clusters Using Helm
Stars: ✭ 18 (-83.49%)
Mutual labels:  version-control, versioning
Sketch Json
Transform sketch files to json and json to sketch files
Stars: ✭ 113 (+3.67%)
Mutual labels:  versioning, version-control
tag
Git utility to create tags in order to identify specific releases
Stars: ✭ 24 (-77.98%)
Mutual labels:  version-control, versioning
QuitStore
🖧 Quads in Git - Distributed Version Control for RDF Knowledge Bases
Stars: ✭ 87 (-20.18%)
Mutual labels:  version-control, versioning
AutoVer
Configurable automatic or real time backup and personal versioning system
Stars: ✭ 65 (-40.37%)
Mutual labels:  version-control, versioning
versionaire
Provides an immutable, thread-safe, and semantic version type.
Stars: ✭ 71 (-34.86%)
Mutual labels:  version-control, versioning
Squot
Squeak Object Tracker - Version control for arbitrary objects, currently with Git storage
Stars: ✭ 45 (-58.72%)
Mutual labels:  version-control, versioning
speckle-unity
AEC Interoperability for Unity through Speckle
Stars: ✭ 28 (-74.31%)
Mutual labels:  version-control, versioning
Python Aos Lesson
Python for Atmosphere and Ocean Scientists
Stars: ✭ 49 (-55.05%)
Mutual labels:  versioning, version-control
gtbump
git tag bump: A simple utility to bump and manage git semantic version tags and generate Markdown changelogs.
Stars: ✭ 15 (-86.24%)
Mutual labels:  version-control, versioning
Json Git
A pure JS local Git to versionize any JSON
Stars: ✭ 109 (+0%)
Mutual labels:  versioning, version-control
Vistrails
VisTrails is an open-source data analysis and visualization tool. It provides a comprehensive provenance infrastructure that maintains detailed history information about the steps followed and data derived in the course of an exploratory task: VisTrails maintains provenance of data products, of the computational processes that derive these products and their executions.
Stars: ✭ 94 (-13.76%)
Mutual labels:  versioning
Laravel Table
Generate tables from Eloquent models.
Stars: ✭ 101 (-7.34%)
Mutual labels:  lists
Awesome Pull Requests
How people work together (PR welcome!)
Stars: ✭ 94 (-13.76%)
Mutual labels:  lists
Awesome Quantified Self
📊 Websites, Resources, Devices, Wearables, Applications, and Platforms for Self Tracking
Stars: ✭ 1,315 (+1106.42%)
Mutual labels:  lists
Make.go
A Go script that could replace your Makefile.
Stars: ✭ 105 (-3.67%)
Mutual labels:  versioning
Labviewgitenv
Everything you need to hold your LabView projects version controlled with GIT.
Stars: ✭ 100 (-8.26%)
Mutual labels:  version-control
Awesome Git Addons
😎 A curated list of add-ons that extend/enhance the git CLI.
Stars: ✭ 1,313 (+1104.59%)
Mutual labels:  lists

Git

Git command reference.

Upload all files in a local directory to a new Git repository

If you have a project on your computer and you just created an empty Git repository in GitHub, use these commands to upload everything to Git.

cd your-directory
git init
git remote add origin [email protected]:your-username/your-repo.git
git add .
git commit -am "Message"
git push -u origin master

Download all files from Git repository to a local directory

The opposite of the above option - for example, if your repository exists in GitHub, and you're working on it in a different local computer. Run this command outside of where you want the new directory to appear (not within the directory you want it to appear).

git clone [email protected]:your-username/your-repo.git     # using SSH
git clone https://github.com/your-username/your-repo.git # using HTTPS

Remove one file from Git cache

Remove one cached file.

git rm -r —-cached file.txt

Override entire local directory

If you have some merge conflicts, or accidentally started to make a change to your local directory before pulling the changes from the master, here's how you can revert your local directory to what's on GitHub.

git fetch --all
git reset --hard origin/master

Ignore a directory

If you've been tracking a directory and later decide to ignore the whole directory, simply adding it to .gitignore isn't enough. First you must add the directory to .gitignore, then run this command:

git rm -r --cached your-directory

Then push the changes.

Add .gitignore to an existing repository

Similar to above, but if you've added a .gitignore with a lot of changes.

git rm -r --cached .
git add .
git commit -m "Message"

Force a push or pull

When you really want your local repository to override the remote.

git push -f origin master
git pull -f origin master

Merging changes from remote pull request with conflicts

Make a new branch with their changes.

git checkout -b their-branch master
git pull their.git master

Play with the files and commit them.

git add files
git commit -m “Message"
git push origin master

Merge back into your branch.

git checkout master
git merge --no-ff <their-branch) (:wq!)
git push origin master

Remove branch

Put a : in front to remove instead of update remotely.

git push origin :branch-name

Use --delete or -D for local.

git branch --delete branch-name

Replace master with contents of another branch

git checkout branch-name
git merge -s ours master
git checkout master
git merge branch-name

Remove all local branches except master

git branch | grep -v "master" | xargs git branch -D

More than one branch may be added to the grep. To remove all local branches except "master" and "develop":

git branch | grep -v "master\|develop" | xargs git branch -D

Allow empty commit

Fix the problem of git hooks claiming everything is "Up-to-date".

git push production master
git commit --allow-empty -m 'push to execute post-receive'
git push production master

Merge new-feature branch into master

Merge branches.

git checkout master
git pull origin master
git merge new-feature
git push origin master

Switch to branch that exists on origin

git fetch --prune --all
git checkout other-branch

Fetch branch from origin

git fetch origin
git checkout --track origin/<remote_branch_name>

Accept all incoming changes

git pull -Xtheirs

Rebase from develop

git fetch --prune --all
git rebase origin/develop
git pull
git push

Stashing

Put your changes away and switch to another branch

git stash
git checkout -b new-branch
git stash pop

Accidentally committed to develop and want to move that commit to a branch

git branch new-branch
git reset HEAD~1
git checkout <files>

GitHub pages to non-docs folder

"dist" or whatever you want.

git subtree push --prefix dist origin gh-pages

Subtree within repo

git subtree add --prefix <local-dir> https://github.com/taniarascia/<repo> master --squash
git subtree pull --prefix <local-dir> https://github.com/taniarascia/<repo> master --squash
git subtree push --prefix <local-dir> https://github.com/taniarascia/<repo> master --squash

Exiting VIM

For those new to command line, ending up at the commit message screen (often when you forget to the add -m flag to a commit) is confusing because pressing escape (or CTRL + C) does not exit the screen, as the default editor for Git is VIM. Instead, press escape (if you've started attempting to type something) and type the following command:

:q

And press enter, and you'll return to where you were.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].