DEV Community

RAHUL DHOLE
RAHUL DHOLE

Posted on • Edited on

Git commands | underrated

Save token

open git config by $git config -e and replace with your GitHub token

[remote "origin"]
        url = https://<TOKEN>@github.com/org/repo.git
        fetch = +refs/heads/*:refs/remotes/origin/*

Enter fullscreen mode Exit fullscreen mode

Rapid fixups using autosquash

# To update last commit
git commit --amend --no-edit 
Enter fullscreen mode Exit fullscreen mode
# to update old commit
git commit --fixup=<HashOfCommitWhichNeedsToBeSquashed>
git rebase -i --autosquash <base commit>
Enter fullscreen mode Exit fullscreen mode

Force push changes

git push --no-tags --set-upstream origin $(git rev-parse --abbrev-ref HEAD) --force
Enter fullscreen mode Exit fullscreen mode

Copy files from container to host and vice versa

docker cp <container_id>:/path/to/container/file/or/directory /path/on/host
docker cp my_container:/app/file.txt /host/path
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more