Git Product home page Git Product logo

configs-and-tricks's Introduction

Configurations and Tricks

My custom configuration scripts and tricks

  1. Customise your Bash Prompt

    • To apply this theme open your bash config
    nano ~/.bashrc
    # you may use any text editor e.g - vim
    vim ~/.bashrc
    • Copy the contents of custom_prompt.sh to the end of .bashrc.
    • Save config file and exit
    # for nano 
    Ctrl + O 
    Enter
    Ctrl + X
    # for vim
    :w
    :q
    • Relaunch terminal or run following command
    source ~/.bashrc
    • You can change colors and add others options too, currently it shows time, user@host, current directory, active git branch,conda virtual environment and cute little emojis showing the success of last command. (๐Ÿ˜Ž:๐Ÿ˜ฉ), Some terminals may not support emojis, replace with :) and :( in that case
  2. Customise your PowerShell prompt

    • Set script execution policy, open a powershell with admin
    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force
    • To apply this prompt you first need to find if there is an existing configuration
    if (!(Test-Path -Path $PROFILE)){ New-Item -Path $PROFILE -ItemType File } ; notepad $PROFILE
    • Copy the contents of profile.ps1 to this file, save and exit
    • Relaunch your powershell
  3. Rebase and sqash commits of an active pull request (git)

    • Confirm or configure upstream
    # make sure you have a upstream configured, to check type 
    git remote -v
    # result will have origin and upstream as below
        origin  https://github.com/<you>/<repo>.git (fetch)
        origin  https://github.com/<you>/<repo>.git (push)
        upstream        https://github.com/<owner>/<repo>.git (fetch)
        upstream        https://github.com/<owner>/<repo>.git (push)

    If yes skip next step

    • Add a upstream
    git remote add upstream https://github.com/<owner>/<repo>.git

    Again check with previous command

    • Update your fork
    # fetch updates from upstream
    git fetch upstream
    # checkout master or main branch
    git checkout master
    # push update to your fork
    git push
    • Rebase your pull request, checkout the original branch used to create pull request
    git checkout pull-request-branch
    # rebase this branch
    git rebase upstream/master

    If you want to sqash your commits then follow the step or skip to last

    • reset last n commits
    git reset --soft HEAD~n
    # new sqashed commit
    git commit -m "commit message"
    • Push your changes
    git push origin +pull-request-branch

    + is required to put before branch name since you are rewriting the history and forcely pushing it

  4. Split a commit in already pushed code or active pull request

    • Rebase last n commits
    git rebase -i HEAD~n

    In the interactive screen simply replace pick with edit in front of the commits you want to modify

    git reset HEAD~
    • Add your files again and commit
    git add ...
    git commit -m "commit 1 message"
    
    git add ...
    git commit -m "commit 2 message"
    .
    .
    git add ...
    git commit -m "last commit message"
    • Continue rebasing
    git rebase --continue
    • Push your changes
    git push origin +branch-name

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.